use of org.springframework.security.web.savedrequest.DefaultSavedRequest in project spring-security by spring-projects.
the class DefaultSavedRequestMixinTests method serializeDefaultRequestBuildWithBuilderTest.
@Test
public void serializeDefaultRequestBuildWithBuilderTest() throws IOException, JSONException {
DefaultSavedRequest request = new DefaultSavedRequest.Builder().setCookies(Collections.singletonList(new SavedCookie(new Cookie("SESSION", "123456789")))).setHeaders(Collections.singletonMap("x-auth-token", Collections.singletonList("12"))).setScheme("http").setRequestURL("http://localhost").setServerName("localhost").setRequestURI("").setLocales(Collections.singletonList(new Locale("en"))).setContextPath("").setMethod("").setServletPath("").build();
String actualString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
JSONAssert.assertEquals(REQUEST_JSON, actualString, true);
}
use of org.springframework.security.web.savedrequest.DefaultSavedRequest in project spring-security by spring-projects.
the class DefaultSavedRequestMixinTests method serializeDefaultRequestBuildWithConstructorTest.
@Test
public void serializeDefaultRequestBuildWithConstructorTest() throws IOException, JSONException {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(new Cookie("SESSION", "123456789"));
request.addHeader("x-auth-token", "12");
String actualString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(new DefaultSavedRequest(request, new PortResolverImpl()));
JSONAssert.assertEquals(REQUEST_JSON, actualString, true);
}
Aggregations