Last active
August 20, 2016 13:53
-
-
Save heitorcolangelo/fa31964c8fe8e395f17cbf2211828eb2 to your computer and use it in GitHub Desktop.
MainActivityTest.java - click on item scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void whenClickOnItemList_shouldStartUserDetailsActivity_withExtra() { | |
server.enqueue(new MockResponse().setResponseCode(200).setBody(Mocks.SUCCESS)); | |
mActivityRule.launchActivity(new Intent()); | |
Intents.init(); | |
Matcher<Intent> matcher = allOf( | |
hasComponent(UserDetailsActivity.class.getName()), | |
hasExtraWithKey(UserDetailsActivity.CLICKED_USER) | |
); | |
Instrumentation.ActivityResult | |
result = new Instrumentation.ActivityResult(Activity.RESULT_OK, null); | |
intending(matcher).respondWith(result); | |
onView(withId(R.id.recycler_view)).perform(actionOnItemAtPosition(0, click())); | |
intended(matcher); | |
Intents.release(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment