Skip to content

Instantly share code, notes, and snippets.

Created August 25, 2013 21:37
@Test
public void testOnMessageMethod() {
MessageListener messageListener = new MessageListener();
Message message = new Message("hi there!");
messageListener.onMessage(message);
Assert.assertEquals(1, messageListener.getMessageCount());
Assert.assertEquals(1, messageListener.getReceivedMessages().size());
Assert.assertEquals(message, messageListener.getReceivedMessages().get(0));
Message anotherMessage = new Message("yo yo");
messageListener.onMessage(anotherMessage);
Assert.assertEquals(2, messageListener.getMessageCount());
Assert.assertEquals(2, messageListener.getReceivedMessages().size());
Assert.assertEquals(anotherMessage, messageListener.getReceivedMessages().get(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment