WrappedOutputStream extends ServletOutputStream { @Override public void close() throws IOException { wrappedStream.close(); } WrappedOutputStream(OutputStream out); long getContentLength(); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void close(); @Override void flush();  }
@Test public void delegatesClose() throws Exception { wrapper.close(); verify(out).close(); }