/** Test the inner class SentChatMessageAdapter */ public void testCase9_SentChatMessageAdapter() throws Throwable { Logger.v(TAG, "testCase9_SentChatMessageAdapter()"); One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter(); IRemoteOne2OneChatWindow remoteChatWindow = (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow(); MockRemoteOne2OneChatWindow mockRemoteChatWindow = (MockRemoteOne2OneChatWindow) remoteChatWindow; SentChatMessageAdapter sentChatMessageAdapter = (SentChatMessageAdapter) chatWindowAdapter.addSentMessage(null, 0); // Test SentChatMessageAdapter#getId() mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled = false; sentChatMessageAdapter.getId(); assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled); // Test SentChatMessageAdapter#updateDate() mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled = false; sentChatMessageAdapter.updateDate(new Date()); assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled); // Test SentChatMessageAdapter#updateStatus() mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled = false; sentChatMessageAdapter.updateStatus(ChatView.ISentChatMessage.Status.DISPLAYED); assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled); }
/** Test the inner class FileTransferAdapter */ public void testCase7_FileTransferAdapter() throws Throwable { Logger.v(TAG, "testCase7_FileTransferAdapter()"); One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter(); IRemoteOne2OneChatWindow remoteChatWindow = (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow(); MockRemoteOne2OneChatWindow mockRemoteChatWindow = (MockRemoteOne2OneChatWindow) remoteChatWindow; FileStruct mockFileStruct = new FileStruct("", "", MOCK_SIZE, new Object(), new Date()); FileTransferAdapter fileTransferAdapter = (FileTransferAdapter) chatWindowAdapter.addReceivedFileTransfer(mockFileStruct); // Test FileTransferAdapter#setFilePath() mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled = false; fileTransferAdapter.setFilePath(MOCK_FILEPATH); assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled); // Test FileTransferAdapter#setProgress() mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled = false; fileTransferAdapter.setProgress(MOCK_PROGRESS); assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled); // Test FileTransferAdapter#setStatus() mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled = false; fileTransferAdapter.setStatus(Status.FINISHED); assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled); }
/** Test the inner class ReceivedChatMessageAdapter */ public void testCase8_ReceivedChatMessageAdapter() throws Throwable { Logger.v(TAG, "testCase8_ReceivedChatMessageAdapter()"); One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter(); IRemoteOne2OneChatWindow remoteChatWindow = (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow(); MockRemoteOne2OneChatWindow mockRemoteChatWindow = (MockRemoteOne2OneChatWindow) remoteChatWindow; ReceivedChatMessageAdapter receivedChatMessageAdapter = (ReceivedChatMessageAdapter) chatWindowAdapter.addReceivedMessage(null, false); // Test FileTransferAdapter#getId() mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled = false; receivedChatMessageAdapter.getId(); assertTrue(mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled); }
/** Test the inner class One2OneChatWindowAdapter */ public void testCase5_One2OneChatWindowAdapter() throws Throwable { Logger.v(TAG, "testCase5_One2OneChatWindowAdapter()"); One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter(); IRemoteOne2OneChatWindow remoteChatWindow = (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow(); MockRemoteOne2OneChatWindow mockRemoteChatWindow = (MockRemoteOne2OneChatWindow) remoteChatWindow; FileStruct mockFileStruct = new FileStruct("", "", MOCK_SIZE, new Object(), new Date()); // Test One2OneChatWindowAdapter#addLoadHistoryHeader() mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false; chatWindowAdapter.addLoadHistoryHeader(false); assertTrue(mockRemoteChatWindow.isAddLoadHistoryHeaderCalled); mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false; // Test One2OneChatWindowAdapter#addReceivedFileTransfer() mockRemoteChatWindow.isAddReceivedFileTransferCalled = false; chatWindowAdapter.addReceivedFileTransfer(mockFileStruct); assertTrue(mockRemoteChatWindow.isAddReceivedFileTransferCalled); mockRemoteChatWindow.isAddReceivedFileTransferCalled = false; // Test One2OneChatWindowAdapter#addReceivedMessage() mockRemoteChatWindow.isAddReceivedMessageCalled = false; chatWindowAdapter.addReceivedMessage(null, false); assertTrue(mockRemoteChatWindow.isAddReceivedMessageCalled); mockRemoteChatWindow.isAddReceivedMessageCalled = false; // Test One2OneChatWindowAdapter#addSentFileTransfer() mockRemoteChatWindow.isAddSentFileTransferCalled = false; chatWindowAdapter.addSentFileTransfer(mockFileStruct); assertTrue(mockRemoteChatWindow.isAddSentFileTransferCalled); mockRemoteChatWindow.isAddSentFileTransferCalled = false; // Test One2OneChatWindowAdapter#addSentMessage() mockRemoteChatWindow.isAddSentMessageCalled = false; chatWindowAdapter.addSentMessage(null, 0); assertTrue(mockRemoteChatWindow.isAddSentMessageCalled); mockRemoteChatWindow.isAddSentMessageCalled = false; // Test One2OneChatWindowAdapter#removeAllMessages() mockRemoteChatWindow.isRemoveAllMessagesCalled = false; chatWindowAdapter.removeAllMessages(); assertTrue(mockRemoteChatWindow.isRemoveAllMessagesCalled); mockRemoteChatWindow.isRemoveAllMessagesCalled = false; // Test One2OneChatWindowAdapter#setFileTransferEnable() mockRemoteChatWindow.isSetFileTransferEnableCalled = false; chatWindowAdapter.setFileTransferEnable(0); assertTrue(mockRemoteChatWindow.isSetFileTransferEnableCalled); mockRemoteChatWindow.isSetFileTransferEnableCalled = false; // Test One2OneChatWindowAdapter#setIsComposing() mockRemoteChatWindow.isSetIsComposingCalled = false; chatWindowAdapter.setIsComposing(false); assertTrue(mockRemoteChatWindow.isSetIsComposingCalled); mockRemoteChatWindow.isSetIsComposingCalled = false; // Test One2OneChatWindowAdapter#setRemoteOfflineReminder() mockRemoteChatWindow.isSetRemoteOfflineReminderCalled = false; chatWindowAdapter.setRemoteOfflineReminder(false); assertTrue(mockRemoteChatWindow.isSetRemoteOfflineReminderCalled); mockRemoteChatWindow.isSetRemoteOfflineReminderCalled = false; // Test One2OneChatWindowAdapter#updateAllMsgAsRead() mockRemoteChatWindow.isUpdateAllMsgAsReadCalled = false; chatWindowAdapter.updateAllMsgAsRead(); assertTrue(mockRemoteChatWindow.isUpdateAllMsgAsReadCalled); mockRemoteChatWindow.isUpdateAllMsgAsReadCalled = false; }