use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertCommonUsersIsNotShownForUnconnectedUserThatIsInAddressBook.
@Test
public void assertCommonUsersIsNotShownForUnconnectedUserThatIsInAddressBook() {
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getConnectionStatus()).thenReturn(User.ConnectionStatus.UNCONNECTED);
int commonUsersCount = 3;
when(mockUser.getCommonConnectionsCount()).thenReturn(commonUsersCount);
String addressBookName = "Mom";
ContactDetails mockContactDetails = mock(ContactDetails.class);
when(mockContactDetails.getDisplayName()).thenReturn(addressBookName);
when(mockUser.getFirstContact()).thenReturn(mockContactDetails);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
final String commonUsersSummary = activity.getResources().getQuantityString(com.waz.zclient.ui.R.plurals.connect_request__common_users__summary, commonUsersCount, commonUsersCount);
final String addressBookInfo = activity.getString(com.waz.zclient.ui.R.string.content__message__connect_request__user_info, addressBookName);
onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
onView(withId(R.id.ttv__user_details__user_info)).check(doesNotContainText(commonUsersSummary));
onView(withId(R.id.ttv__user_details__user_info)).check(hasText(addressBookInfo));
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertCommonUsersIsShownForPendingOutgoingUserThatIsNotInAddressBook.
@Test
public void assertCommonUsersIsShownForPendingOutgoingUserThatIsNotInAddressBook() {
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getConnectionStatus()).thenReturn(User.ConnectionStatus.PENDING_FROM_USER);
int commonUsersCount = 3;
when(mockUser.getCommonConnectionsCount()).thenReturn(commonUsersCount);
when(mockUser.getFirstContact()).thenReturn(null);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
final String commonUsersSummary = activity.getResources().getQuantityString(com.waz.zclient.ui.R.plurals.connect_request__common_users__summary, commonUsersCount, commonUsersCount);
onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
onView(withId(R.id.ttv__user_details__user_info)).check(hasText(commonUsersSummary));
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertCommonUsersIsShownForUnconnectedUserThatIsNotInAddressBook.
@Test
public void assertCommonUsersIsShownForUnconnectedUserThatIsNotInAddressBook() {
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getConnectionStatus()).thenReturn(User.ConnectionStatus.UNCONNECTED);
int commonUsersCount = 3;
when(mockUser.getCommonConnectionsCount()).thenReturn(commonUsersCount);
when(mockUser.getFirstContact()).thenReturn(null);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
final String commonUsersSummary = activity.getResources().getQuantityString(com.waz.zclient.ui.R.plurals.connect_request__common_users__summary, commonUsersCount, commonUsersCount);
onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
onView(withId(R.id.ttv__user_details__user_info)).check(hasText(commonUsersSummary));
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertExistingUserHandleIsVisible.
@Test
public void assertExistingUserHandleIsVisible() {
String handle = "red_panda";
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getUsername()).thenReturn(handle);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
onView(withId(R.id.ttv__user_details__user_name)).check(isVisible());
onView(withId(R.id.ttv__user_details__user_name)).check(hasText(StringUtils.formatHandle(handle)));
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertEmptyUserHandleIsNotShown.
@Test
public void assertEmptyUserHandleIsNotShown() {
String handle = "";
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getUsername()).thenReturn(handle);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
onView(withId(R.id.ttv__user_details__user_name)).check(isGone());
}
Aggregations