Search in sources :

Example 1 with Self

use of com.waz.api.impl.Self in project wire-android by wireapp.

the class UsernamesTakeOverScreenTest method verifyUserHasTakeOverScreenWithUsername.

@Test
public void verifyUserHasTakeOverScreenWithUsername() {
    activity.setOnChooseUsernameChosenCalled(false);
    activity.setOnKeepUsernameCalled(false);
    Self mockSelf = mock(Self.class);
    when(mockSelf.getName()).thenReturn(DEFAULT_DISPLAY_NAME);
    when(mockSelf.getUsername()).thenReturn("");
    IZMessagingApiStore mockZMessagingApiStore = activity.getStoreFactory().getZMessagingApiStore();
    ZMessagingApi mockZMessagingApi = mock(ZMessagingApi.class);
    when(mockZMessagingApiStore.getApi()).thenReturn(mockZMessagingApi);
    when(mockZMessagingApi.getSelf()).thenReturn(mockSelf);
    attachFragment(FirstTimeAssignUsernameFragment.newInstance(mockSelf.getName(), DEFAULT_DISPLAY_USERNAME), FirstTimeAssignUsernameFragment.TAG);
    onView(withId(R.id.ttv__name)).check(matches(withText(mockSelf.getName())));
    onView(withId(R.id.ttv__username)).check(matches(withText(StringUtils.formatHandle(DEFAULT_DISPLAY_USERNAME))));
}
Also used : ZMessagingApi(com.waz.api.ZMessagingApi) Self(com.waz.api.impl.Self) IZMessagingApiStore(com.waz.zclient.core.stores.api.IZMessagingApiStore) Test(org.junit.Test) FragmentTest(com.waz.zclient.testutils.FragmentTest)

Aggregations

ZMessagingApi (com.waz.api.ZMessagingApi)1 Self (com.waz.api.impl.Self)1 IZMessagingApiStore (com.waz.zclient.core.stores.api.IZMessagingApiStore)1 FragmentTest (com.waz.zclient.testutils.FragmentTest)1 Test (org.junit.Test)1