LocalhostRequestRouter implements ApplicationListener<ContextRefreshedEvent> { public void reroute(final WilmaHttpRequest request) { try { URI uri; uri = createUri(); request.setUri(uri); } catch (URISyntaxException e) { logger.error(e.getMessage()); } }  void reroute(final WilmaHttpRequest request); @Override void onApplicationEvent(final ContextRefreshedEvent event);  }
@Test public void testThatRerouteShouldSetRequestUriToServletAddress() throws URISyntaxException { URI expected = new URI("http: underTest.reroute(request); verify(request).setUri(expected); }