verify(inHandler, never()).listMessages(any(Connection.class), any(MessageCriteria.class));
}
@Test
public void testListInboundMessages() throws Exception {
MessageHandler outHandler = mock(MessageHandler.class);
MessageHandler inHandler = mock(MessageHandler.class);
when(inHandler.listMessages(any(Connection.class), any(MessageCriteria.class)))
.thenReturn(Collections.singleton(new Message()));
Connection conn = mock(Connection.class);
MessageHandler handler = createMessageHandler(outHandler, inHandler);
Collection<Message> message = handler.listMessages(conn,
new MessageCriteria().direction(Direction.TO_APPLICATIONS));
Assert.assertEquals(1, message.size());
verify(outHandler, never()).listMessages(any(Connection.class), any(MessageCriteria.class));
}