NoCloseOutputStream extends OutputStream { @Override public void write(int b) throws IOException { outputStream.write(b); } NoCloseOutputStream(OutputStream outputStream); @Override void write(int b); void close();  }
@Test public void testWrite() throws IOException { noCloseOutputStream.write(17); Mockito.verify(outputStream).write(17); Mockito.verifyNoMoreInteractions(outputStream); }