class JmsMessageListener implements MessageListener {

	@Override
	public void onMessage(Message msg) {
		logger.debug("received new message from queue '{}'", queue);
		String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg));
		SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg));
		storage.addMessage(message);
	}

}

class JmsMessageListenerTest {

	private JmsMessageListener sut;
	private LocalMessageStorage storage;

	@Test
	public void shouldAddNewMapMessageToStorage() throws JMSException {

		MockMapMessage message = new MockMapMessage();
		message.setString("myText", "my awesome message \uF609");

		sut.onMessage(message);

		Collection<SimpleMessage> resultInStorage = storage.getMessagesAfter(0);
		assertThat(resultInStorage).hasSize(1);
		SimpleMessage first = resultInStorage.iterator().next();

		assertThat(first.getText()).isNotNull();
		assertThat(first.getProps()).isEmpty();
	}

}