### Question:
MultiReadHttpServletResponse extends ContentCachingResponseWrapper { public byte[] getCachedContent() { return this.getContentAsByteArray(); } MultiReadHttpServletResponse(HttpServletResponse response); byte[] getCachedContent();  }### Answer:
@Test void getCachedContent_shouldReturnContentFromOutputStream() throws IOException { MultiReadHttpServletResponse multiReadHttpServletResponse = new MultiReadHttpServletResponse(response); multiReadHttpServletResponse.getOutputStream().write(CONTENT.getBytes()); byte[] cachedContent = multiReadHttpServletResponse.getCachedContent(); assertArrayEquals(CONTENT.getBytes(), cachedContent); }
@Test void getCachedContent_shouldReturnContentFromWriter() throws IOException { MultiReadHttpServletResponse multiReadHttpServletResponse = new MultiReadHttpServletResponse(response); multiReadHttpServletResponse.getWriter().write(CONTENT); byte[] cachedContent = multiReadHttpServletResponse.getCachedContent(); assertArrayEquals(CONTENT.getBytes(), cachedContent); }