use of org.forgerock.json.resource.http.HttpContext in project OpenAM by OpenRock.
the class RequestValuesBaseURLProviderTest method testGetBaseURLFromHTTPContextWithContextPath.
@Test
public void testGetBaseURLFromHTTPContextWithContextPath() throws Exception {
// Given
HttpContext httpContext = new HttpContext(json(object(field(BaseURLConstants.ATTR_HEADERS, Collections.emptyMap()), field(BaseURLConstants.ATTR_PARAMETERS, Collections.emptyMap()), field("path", "http://fred:8080/toto"))), null);
provider.setContextPath("/openam");
// When
String url = provider.getRootURL(httpContext);
// Then
assertThat(url).isEqualTo("http://fred:8080/openam");
}
Aggregations