@Test public void testClose() throws Exception { doThrow(new JMSException("")).when(session).close(); consumer = create(); consumer.close(); verify(session, times(1)).close(); verify(connection, times(1)).close(); }
void close() { try { if (session != null) { session.close(); } } catch (JMSException e) { logger.error("Could not destroy session", e); } try { if (connection != null) { connection.close(); } } catch (JMSException e) { logger.error("Could not destroy connection", e); } }
JMSMessageConsumer { void close() { try { if (session != null) { session.close(); } } catch (JMSException e) { logger.error("Could not destroy session", e); } try { if (connection != null) { connection.close(); } } catch (JMSException e) { logger.error("Could not destroy connection", e); } } }
JMSMessageConsumer { void close() { try { if (session != null) { session.close(); } } catch (JMSException e) { logger.error("Could not destroy session", e); } try { if (connection != null) { connection.close(); } } catch (JMSException e) { logger.error("Could not destroy connection", e); } } 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); }
JMSMessageConsumer { void close() { try { if (session != null) { session.close(); } } catch (JMSException e) { logger.error("Could not destroy session", e); } try { if (connection != null) { connection.close(); } } catch (JMSException e) { logger.error("Could not destroy connection", e); } } 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);  }
JMSMessageConsumer { void close() { try { if (session != null) { session.close(); } } catch (JMSException e) { logger.error("Could not destroy session", e); } try { if (connection != null) { connection.close(); } } catch (JMSException e) { logger.error("Could not destroy connection", e); } } 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);   }