ServletUtils { public static void updateServletResponse(HttpServletResponse servletResponse, HttpResponse response) { if (servletResponse == null || response == null) return; servletResponse.setStatus(response.getStatus()); setHeaders(servletResponse, response.getHeaders()); try { setBody(servletResponse, response.getBody()); } catch(IOException ex) { throw new FalteringEnvironmentException(ex); } }  static HttpRequest buildRequest(HttpServletRequest servletRequest); static void updateServletResponse(HttpServletResponse servletResponse, HttpResponse response);  }
@Test void test() throws IOException { HttpServletResponse servletResponse = mock(HttpServletResponse.class); PrintWriter writer = mock(PrintWriter.class); when(servletResponse.getWriter()).thenReturn(writer); HttpResponse response = builder(HttpResponse.of("")) .set(HttpResponse::setHeaders, Headers.of("AAA", 1)) .build(); ServletUtils.updateServletResponse(servletResponse, response); }