MessageLoggingToggle implements ApplicationListener<ContextRefreshedEvent> { public boolean isRequestLoggingOn() { return requestProcessor.isProcessorEnabled(jmsRequestLoggerProcessor); }  @Override void onApplicationEvent(final ContextRefreshedEvent event); void switchOffMessageLogging(); void switchOnMessageLogging(); boolean isRequestLoggingOn(); boolean isResponseLoggingOn();  }
@Test public final void testIsRequestLoggingOnReturnsTrueIfHandlerContainsProcessor() { given(requestHandler.containsProcessor(jmsRequestLogger)).willReturn(true); given(requestHandler.isProcessorEnabled(jmsRequestLogger)).willReturn(true); boolean actual = underTest.isRequestLoggingOn(); verify(requestHandler).isProcessorEnabled(jmsRequestLogger); assertTrue(actual); }
@Test public final void testIsRequestLoggingOnReturnsFalseIfHandlerDoesntContainProcessor() { given(requestHandler.isProcessorEnabled(jmsRequestLogger)).willReturn(false); boolean actual = underTest.isRequestLoggingOn(); verify(requestHandler).isProcessorEnabled(jmsRequestLogger); assertFalse(actual); }