httpResponse.withStatusCode(HttpStatusCode.OK_200.code());
httpResponse.withBody("somebody");
httpResponse.withHeaders(new Header("headerName1", "headerValue1"), new Header("headerName2", "headerValue2"));
httpResponse.withCookies(new Cookie("cookieName1", "cookieValue1"), new Cookie("cookieName2", "cookieValue2"));
// - an HttpServletResponse
MockHttpServletResponse httpServletResponse = new MockHttpServletResponse();
// when
new MockServerToHttpServletResponseMapper().mapMockServerResponseToHttpServletResponse(httpResponse, httpServletResponse);
// then
assertEquals(HttpStatusCode.OK_200.code(), httpServletResponse.getStatus());
assertEquals("somebody", httpServletResponse.getContentAsString());
assertEquals("headerValue1", httpServletResponse.getHeader("headerName1"));
assertEquals("headerValue2", httpServletResponse.getHeader("headerName2"));
assertEquals(Arrays.asList(
"cookieName1=cookieValue1",
"cookieName2=cookieValue2"
), httpServletResponse.getHeaders("Set-Cookie"));
}