JMSMessageConsumer { void rollback() { try { session.rollback(); } catch (JMSException jmsException) { logger.warn("JMS Exception processing rollback", jmsException); } catch (RuntimeException runtimeException) { logger.warn("Runtime Exception processing rollback", 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 testRollback() throws Exception { consumer = create(); consumer.rollback(); verify(session, times(1)).rollback(); }
@Test public void testRollbackFailsDueToJMSException() throws JMSException { doThrow(new JMSException("")).when(session).rollback(); consumer = create(); consumer.rollback(); }
@Test public void testRollbackFailsDueToRuntimeException() throws JMSException { doThrow(new RuntimeException()).when(session).rollback(); consumer = create(); consumer.rollback(); }