LocalhostRequestRouter implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(final ContextRefreshedEvent event) { PropertyDTO propertyDTO = routeEngineConfigurationAccess.getProperties(); internalPort = propertyDTO.getProxyPort(); }  void reroute(final WilmaHttpRequest request); @Override void onApplicationEvent(final ContextRefreshedEvent event);  }
@Test public void testWhenOnApplicationEventReceivedShouldSetInternalPort() { given(routeEngineConfigurationAccess.getProperties()).willReturn(propertyDTO); given(propertyDTO.getProxyPort()).willReturn(9876); underTest.onApplicationEvent(null); assertEquals(9876, Whitebox.getInternalState(underTest, "internalPort")); }