Skip to content

Instantly share code, notes, and snippets.

@heitorcolangelo
Last active September 3, 2016 18:29
Show Gist options
  • Save heitorcolangelo/2551db7f8dfe1d7b7ba84d460ca3a8b4 to your computer and use it in GitHub Desktop.
Save heitorcolangelo/2551db7f8dfe1d7b7ba84d460ca3a8b4 to your computer and use it in GitHub Desktop.
UserDetailsActivity - check no info text
@Test
public void whenEmailIsMissing_shouldDisplay_noInfoMessage() {
mActivityRule.launchActivity(createIntent(true));
onView(withId(R.id.user_details_image)).check(matches(isDisplayed()));
onView(withId(R.id.user_details_name)).check(matches(isDisplayed()));
onView(allOf(
withId(R.id.image_and_text_image),
hasSibling(withText("No info available."))))
.check(matches(isDisplayed()));
}
private Intent createIntent(boolean missingInfo) {
return new Intent().putExtra(UserDetailsActivity.CLICKED_USER, getMockedUser(missingInfo));
}
private UserVO getMockedUser(boolean missingInfo) {
final String mock = missingInfo ? Mocks.USER_MISSING_INFO : Mocks.USER;
return UsersApi.GSON.fromJson(mock, UserVO.class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment