HttpServletResponseImpl implements HttpServletResponse { @Override public PrintWriter getWriter() { if (printWriter == null) { if (isTransferChunked()) { printWriter = new ChunkedPrintWriter(wrappedOutputStream); } else { printWriter = new ServletPrintWriter(wrappedOutputStream); } } return printWriter; } HttpServletResponseImpl(final Serializer<Headers> headersSerializer,
                                   final Serializer<Cookie> cookieHeaderSerializer,
                                   final StreamHelper streamHelper,
                                   final OutputStream outputStream); @Override void addCookie(final Cookie cookie); @Override List<Cookie> getCookies(); @Override boolean isCommitted(); @Override void reset(); @Override void resetBuffer(); @Override void setBufferSize(final int bufferSize); @Override void setCharacterEncoding(final String charset); @Override void sendRedirect(final String location); @Override void setContentType(final String contentType); @Override void setLocale(final Locale loc); @Override void flushBuffer(); @Override int getBufferSize(); @Override String getCharacterEncoding(); @Override String getContentType(); @Override Locale getLocale(); @Override void setKeepAlive(final boolean keepAlive); @Override void setContentLength(final int length); @Override void setContentLength(final long length); @Override Headers getHeaders(); @Override void setStatus(final String status); @Override void setHeader(final String name, final String value); @Override void setIntHeader(final String name, final int value); @Override PrintWriter getWriter(); @Override ServletOutputStream getOutputStream(); void flushHeaders(); void serveStream(final InputStream inputStream); void serveStream(final InputStream inputStream, final Range range); void serveStream(final InputStream inputStream,
                            final List<Range> rangeList,
                            final String boundary,
                            final String contentType,
                            final long totalLength); String getStatus(); void flush();  }
@Test public void shouldNotCreateASinglePrintWriter() throws IOException { assertThat(httpServletResponseImpl.getWriter().equals(httpServletResponseImpl.getWriter()), is(true)); }