Tomcat7CommitSessionOutputBuffer implements OutputBuffer { @Override public int doWrite(final ByteChunk chunk, final Response response) throws IOException { sessionCommitter.commit(); return delegate.doWrite(chunk, response); } Tomcat7CommitSessionOutputBuffer(final SessionCommitter sessionCommitter,
      final OutputBuffer delegate); @Override int doWrite(final ByteChunk chunk, final Response response); @Override long getBytesWritten();  }
@Test public void doWrite() throws IOException { final ByteChunk byteChunk = new ByteChunk(); final Response response = new Response(); commitSesssionOutputBuffer.doWrite(byteChunk, response); final InOrder inOrder = inOrder(sessionCommitter, delegate); inOrder.verify(sessionCommitter).commit(); inOrder.verify(delegate).doWrite(byteChunk, response); inOrder.verifyNoMoreInteractions(); }