use of com.waz.zclient.core.stores.conversation.ConversationStoreObserver in project wire-android by wireapp.
the class MockHelper method setupConversationMocks.
public static void setupConversationMocks(final IConversation mockConversation, final TestActivity activity) {
IConversationStore mockConversationStore = activity.getStoreFactory().getConversationStore();
when(mockConversationStore.getCurrentConversation()).thenReturn(mockConversation);
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();
ConversationStoreObserver o = (ConversationStoreObserver) args[0];
o.onCurrentConversationHasChanged(null, mockConversation, ConversationChangeRequester.UPDATER);
return null;
}
}).when(mockConversationStore).addConversationStoreObserverAndUpdate(any(ConversationStoreObserver.class));
doAnswer(new Answer<Void>() {
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
ConversationStoreObserver o = (ConversationStoreObserver) args[0];
o.onCurrentConversationHasChanged(null, mockConversation, ConversationChangeRequester.UPDATER);
return null;
}
}).when(mockConversationStore).addConversationStoreObserver(any(ConversationStoreObserver.class));
}
Aggregations