ApplicationConfiguration implements Configuration { public String getApplicationPath() { return request.getScheme() + ": + (request.getServerPort() != 80? ":" + request.getServerPort() : "") + request.getContextPath(); } ApplicationConfiguration(HttpServletRequest request); String getApplicationPath();  }
@Test public void shouldNotUsePortWhenPortIs80() { when(request.getScheme()).thenReturn("http"); when(request.getServerName()).thenReturn("caelum.com.br"); when(request.getServerPort()).thenReturn(80); when(request.getContextPath()).thenReturn("/context/"); assertEquals("http: }
@Test public void shouldGiveFullUrlWithPortWhenPortIsNot80() { when(request.getScheme()).thenReturn("http"); when(request.getServerName()).thenReturn("caelum.com.br"); when(request.getServerPort()).thenReturn(8080); when(request.getContextPath()).thenReturn("/context/"); assertEquals("http: }