Skip to content

Instantly share code, notes, and snippets.

@vuhung3990
Created June 20, 2017 10:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
test intent
androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
public class MainActivityTest {
@Rule
public IntentsTestRule<MainActivity> rule = new IntentsTestRule<MainActivity>(MainActivity.class);
@Test
public void openExport_shouldPass() throws Exception {
onView(withId(R.id.export_contact)).perform(click());
intended(
allOf(
hasComponent(ContactActivity.class.getCanonicalName()),
hasExtras(
allOf(
hasEntry(equalTo(ContactActivity.TITLE), equalTo(R.string.export_title))
)
)
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment