JMSMessageConsumer { void commit() { try { session.commit(); } catch (JMSException jmsException) { logger.warn("JMS Exception processing commit", jmsException); } catch (RuntimeException runtimeException) { logger.warn("Runtime Exception processing commit", runtimeException); } } JMSMessageConsumer(InitialContext initialContext, ConnectionFactory connectionFactory,
                     String destinationName, JMSDestinationLocator destinationLocator,
                     JMSDestinationType destinationType, String messageSelector, int batchSize,
                     long pollTimeout, JMSMessageConverter messageConverter,
                     Optional<String> userName, Optional<String> password,
                     Optional<String> clientId, boolean createDurableSubscription,
                     String durableSubscriptionName);   }
@Test public void testCommit() throws Exception { consumer = create(); consumer.commit(); verify(session, times(1)).commit(); }
@Test public void testCommitFailsDueToJMSException() throws JMSException { doThrow(new JMSException("")).when(session).commit(); consumer = create(); consumer.commit(); }
@Test public void testCommitFailsDueToRuntimeException() throws JMSException { doThrow(new RuntimeException()).when(session).commit(); consumer = create(); consumer.commit(); }