ProxyModeToggle implements ApplicationListener<ContextRefreshedEvent> { public void switchProxyModeOn() { if (requestProcessor.containsProcessor(routerProcessor)) { requestProcessor.disableProcessor(routerProcessor); } }  @Override void onApplicationEvent(final ContextRefreshedEvent event); void switchProxyModeOn(); void switchProxyModeOff(); boolean isProxyModeOn();  }
@Test public void testSwitchProxyModeOnWhenRouterProcessorIsInListShouldDisableProcessor() { given(requestProcessor.containsProcessor(routerProcessor)).willReturn(true); underTest.switchProxyModeOn(); verify(requestProcessor).disableProcessor(routerProcessor); }
@Test public void testSwitchProxyModeOnWhenRouterProcessorIsNotInListShouldDoNothing() { given(requestProcessor.containsProcessor(routerProcessor)).willReturn(false); underTest.switchProxyModeOn(); verify(requestProcessor, never()).disableProcessor(routerProcessor); }