LocalhostRequestChecker { public boolean checkIfRequestTargetsLocalhost(final WilmaHttpRequest request) { URI requestUri = request.getUri(); return isLocalhost(requestUri); }  boolean checkIfRequestTargetsLocalhost(final WilmaHttpRequest request);  }
@Test public void testCheckConditionShouldReturnTrueWhenRequestHasLocalhostIpUri() throws URISyntaxException { uri = new URI("http: given(request.getUri()).willReturn(uri); boolean actualResult = underTest.checkIfRequestTargetsLocalhost(request); assertTrue(actualResult); }
@Test public void testCheckConditionShouldReturnTrueWhenRequestHasLocalhostNameUri() throws URISyntaxException { uri = new URI("http: given(request.getUri()).willReturn(uri); boolean actualResult = underTest.checkIfRequestTargetsLocalhost(request); assertTrue(actualResult); }
@Test public void testCheckConditionShouldReturnFalseWhenRequestHasNonLocalhostUri() throws URISyntaxException { uri = new URI("http: given(request.getUri()).willReturn(uri); boolean actualResult = underTest.checkIfRequestTargetsLocalhost(request); assertFalse(actualResult); }