@Test public void testSendMessageToIndexerWhenCannotConnectShouldLogError() { Whitebox.setInternalState(underTest, "logger", logger); given(messageCreatorFactory.createJmsMessageCreator(message)).willThrow(new RuntimeException()); underTest.sendMessageToIndexer(message); verify(logger).info(Mockito.anyString(), Mockito.any(Exception.class)); }
public void sendMessageToIndexer(final IndexMessage message) { try { jmsTemplateForIndexing.send(messageCreatorFactory.createJmsMessageCreator(message)); turnOnConnectionErrorLog(); } catch (Exception e) { turnOffConnectionErrorLog(e); } }
JmsMessageIndexer { public void sendMessageToIndexer(final IndexMessage message) { try { jmsTemplateForIndexing.send(messageCreatorFactory.createJmsMessageCreator(message)); turnOnConnectionErrorLog(); } catch (Exception e) { turnOffConnectionErrorLog(e); } } }
JmsMessageIndexer { public void sendMessageToIndexer(final IndexMessage message) { try { jmsTemplateForIndexing.send(messageCreatorFactory.createJmsMessageCreator(message)); turnOnConnectionErrorLog(); } catch (Exception e) { turnOffConnectionErrorLog(e); } }  }
JmsMessageIndexer { public void sendMessageToIndexer(final IndexMessage message) { try { jmsTemplateForIndexing.send(messageCreatorFactory.createJmsMessageCreator(message)); turnOnConnectionErrorLog(); } catch (Exception e) { turnOffConnectionErrorLog(e); } }  void sendMessageToIndexer(final IndexMessage message); }
JmsMessageIndexer { public void sendMessageToIndexer(final IndexMessage message) { try { jmsTemplateForIndexing.send(messageCreatorFactory.createJmsMessageCreator(message)); turnOnConnectionErrorLog(); } catch (Exception e) { turnOffConnectionErrorLog(e); } }  void sendMessageToIndexer(final IndexMessage message);  }