public void testListWithNotSupportedDirectionCriteria() throws Exception {
MessageHandler handler = mock(MessageHandler.class);
when(handler.supportsDirection(any(Direction.class))).thenReturn(false);
DataSource dataSource = mockDataSource();
JdbcMessageStore messageStore = createMessageStore(dataSource, handler);
MessageCriteria criteria = new MessageCriteria()
.direction(Direction.TO_APPLICATIONS);
Collection<Message> messages = messageStore.list(criteria);
Assert.assertNotNull(messages);
Assert.assertEquals(0, messages.size());
verify(handler, never()).listMessages(any(Connection.class), any(MessageCriteria.class));
}