Router implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(final ContextRefreshedEvent event) { PropertyDTO properties = configurationAccess.getProperties(); internalPort = properties.getProxyPort(); }  void reroute(final WilmaHttpRequest request); @Override void onApplicationEvent(final ContextRefreshedEvent event); Integer getInternalPort(); void setHost(final String host); void setPath(final String path);  }
@Test public void testOnApplicationEventShouldSetInternalPort() { given(configurationAccess.getProperties()).willReturn(properties); given(properties.getProxyPort()).willReturn(internalPort); underTest.onApplicationEvent(event); Integer actual = (Integer) Whitebox.getInternalState(underTest, "internalPort"); assertEquals(actual, internalPort); }