use of com.fanap.podchat.requestobject.RequestForwardMessage in project pod-chat-android-sdk by FanapSoft.
the class MessagesCacheTest method forwardMessageAndCheckCache.
@Test
public void forwardMessageAndCheckCache() {
populateThreadsListFromServerOnly();
populateMessagesFromServer();
assert threads.size() > 1;
assert threadMessagesList.size() > 0;
Collections.shuffle(threads);
Thread thread2 = threads.get(1);
MessageVO message = threadMessagesList.get(0);
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.setListener(mTestListener);
RequestForwardMessage forRequest = new RequestForwardMessage.Builder(thread2.getId(), new ArrayList<>(Collections.singletonList(message.getId()))).build();
chat.forwardMessage(forRequest);
sleep(2000);
RequestGetHistory requestGetHistory = new RequestGetHistory.Builder(thread2.getId()).build();
chat.getHistory(requestGetHistory, null);
Mockito.verify(mTestListener, Mockito.after(2000).atLeastOnce()).onGetHistory(Mockito.any(), Mockito.argThat((ChatResponse<ResultHistory> response) -> response.isCache() && response.getResult().getHistory().stream().anyMatch(messageVO -> messageVO.getForwardInfo() != null)));
}
use of com.fanap.podchat.requestobject.RequestForwardMessage in project pod-chat-android-sdk by FanapSoft.
the class MessagesCacheTest method forwardMessage.
@Test
public void forwardMessage() {
populateThreadsListFromServerOnly();
populateMessagesFromServer();
assert threads.size() > 1;
assert threadMessagesList.size() > 0;
Thread thread = threads.get(0);
Thread thread2 = threads.get(1);
MessageVO message = threadMessagesList.get(0);
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.setListener(mTestListener);
RequestForwardMessage forRequest = new RequestForwardMessage.Builder(thread2.getId(), new ArrayList<>(Collections.singletonList(message.getId()))).build();
chat.forwardMessage(forRequest);
Mockito.verify(mTestListener, Mockito.after(2000).atLeastOnce()).onNewMessage(Mockito.any(), Mockito.any());
sleep(2000);
}
use of com.fanap.podchat.requestobject.RequestForwardMessage in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method forwardMessage.
public void forwardMessage() {
ArrayList<Long> messageIds = new ArrayList<>();
messageIds.add(73328L);
messageIds.add(73327L);
messageIds.add(73326L);
long threadId = TEST_THREAD_ID;
// presenter.forwardMessage(threadId, messageIds);
RequestForwardMessage forwardMessage = new RequestForwardMessage.Builder(threadId, messageIds).build();
presenter.forwardMessage(forwardMessage);
}
Aggregations