JmsUtils { public static String getJMSMessageID(Message message) { String result; try { result = message.getJMSMessageID(); } catch (JMSException e) { LOGGER.error(e.getMessage(), e); result = null; } return result; } private  JmsUtils(); static void closeQuietly(MessageProducer messageProducer); static void closeQuietly(MessageConsumer messageConsumer); static void closeQuietly(Session session); static void closeQuietly(Connection connection); static T getFromMessage(Message message, Class<T> tClass); static String getJMSCorrelationID(Message message); static String getJMSMessageID(Message message);  }
@Test public void getJMSMessageId_expectJMSMessageId() throws Exception { Message message = Mockito.mock(Message.class); final String id = "1000000"; when(message.getJMSMessageID()).thenReturn(id); final String messageId = JmsUtils.getJMSMessageID(message); assertThat(messageId, is(id)); }