HttpResponseWrapper extends HttpServletResponseWrapper implements ResponseWithSessionId { @Override public void setHeader(String name, String value) { checkContentLenghtHeader(name, value); super.setHeader(name, value); } HttpResponseWrapper(HttpRequestWrapper request, HttpServletResponse response); @Override final void sendError(int sc); @Override final void sendError(int sc, String msg); @Override final void sendRedirect(String location); @Override SaveSessionServletOutputStream getOutputStream(); @Override PrintWriter getWriter(); @Override void addHeader(String name, String value); @Override void setHeader(String name, String value); @Override void setContentLength(int len); @Override void reset(); @Override String encodeURL(String url); @Override void flushBuffer();  }
@Test public void testSetHeaderContentLength() throws IOException { responseWrapper.setHeader("content-length", "10"); assertEquals(10, responseWrapper.contentLength); verify(response).setHeader("content-length", "10"); }
@Test public void testPropagateSetHeader() throws IOException { responseWrapper.setHeader("some-header", "value"); verify(response).setHeader("some-header", "value"); }