### Question:
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(ConnectionFactory connectionFactory,
      String destinationName, JMSDestinationType destinationType,
      String messageSelector, int batchSize, long pollTimeout,
      JMSMessageConverter messageConverter, Optional<String> userName,
      Optional<String> password);   }### Answer:
@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(); }