use of jetbrains.communicator.mock.MockMessage in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method testUserDeleted.
public void testUserDeleted() throws Exception {
MockMessage failedMessage = new MockMessage(false);
myDispatcher.performDispatch(myUser, failedMessage);
getBroadcaster().fireEvent(new UserEvent.Removed(myUser));
assertEquals("Queue should be cleared when user is deleted", 0, myDispatcher.getPendingMessages(myUser).length);
}
use of jetbrains.communicator.mock.MockMessage in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method testSuccessfulSendingOfPendingEvent.
public void testSuccessfulSendingOfPendingEvent() throws Exception {
myUser.setOnline(true);
MockMessage failedMessage = new MockMessage(false);
myDispatcher.performDispatch(myUser, failedMessage);
failedMessage.setSendSuccessful(true);
myDispatcher.performDispatch(myUser, failedMessage);
assertEquals("If sent successful, remove from pending queue", 0, myDispatcher.getPendingMessages(myUser).length);
}
use of jetbrains.communicator.mock.MockMessage in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method testMessagesQueue.
public void testMessagesQueue() throws Exception {
assertEquals("No pending messages", 0, myDispatcher.getPendingMessages(myUser).length);
myDispatcher.performDispatch(myUser, new MockMessage());
assertEquals("Sent successfully, queue is still empty", 0, myDispatcher.getPendingMessages(myUser).length);
// queue failed message
MockMessage failedMessage = new MockMessage(false);
myDispatcher.performDispatch(myUser, failedMessage);
assertEquals("Failed message should be queued", 1, myDispatcher.getPendingMessages(myUser).length);
assertSame(failedMessage, myDispatcher.getPendingMessages(myUser)[0]);
}
use of jetbrains.communicator.mock.MockMessage in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method testSendSameMessageTwice.
public void testSendSameMessageTwice() throws Exception {
MockMessage failedMessage = new MockMessage(false);
myDispatcher.performDispatch(myUser, failedMessage);
myDispatcher.performDispatch(myUser, failedMessage);
assertEquals("Only one message should be queued", 1, myDispatcher.getPendingMessages(myUser).length);
}
use of jetbrains.communicator.mock.MockMessage in project intellij-plugins by JetBrains.
the class LocalMessageDispatcherTest method testClearHistory.
public void testClearHistory() throws Exception {
assertTrue(myDispatcher.isHistoryEmpty());
MockMessage message = new MockMessage();
myDispatcher.sendNow(myUser, message);
myDispatcher.clearHistory();
assertEquals(0, myDispatcher.getHistory(myUser, null).length);
}
Aggregations