use of com.waz.zclient.core.stores.participants.IParticipantsStore in project wire-android by wireapp.
the class MockHelper method setupParticipantsMocks.
public static void setupParticipantsMocks(final IConversation mockConversation, final TestActivity activity) {
IParticipantsStore mockParticipantsStore = activity.getStoreFactory().getParticipantsStore();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
UpdateListener u = (UpdateListener) args[0];
u.updated();
return null;
}
}).when(mockConversation).addUpdateListener(any(UpdateListener.class));
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
ParticipantsStoreObserver o = (ParticipantsStoreObserver) args[0];
o.conversationUpdated(mockConversation);
return null;
}
}).when(mockParticipantsStore).addParticipantsStoreObserver(any(ParticipantsStoreObserver.class));
INetworkStore mockNetworkStore = activity.getStoreFactory().getNetworkStore();
when(mockNetworkStore.hasInternetConnection()).thenReturn(true);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
NetworkAction a = (NetworkAction) args[0];
a.execute(NetworkMode.WIFI);
return null;
}
}).when(mockNetworkStore).doIfHasInternetOrNotifyUser(any(NetworkAction.class));
}
Aggregations