Skip to content

Instantly share code, notes, and snippets.

@vuhung3990
Created June 20, 2017 10:46
Show Gist options
  • Save vuhung3990/a0a38c4c371c1c40f923641fb08dc8f7 to your computer and use it in GitHub Desktop.
Save vuhung3990/a0a38c4c371c1c40f923641fb08dc8f7 to your computer and use it in GitHub Desktop.
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