Tomcat9CommitSessionOutputBuffer implements OutputBuffer { @Override public int doWrite(final ByteBuffer chunk) throws IOException { sessionCommitter.commit(); return delegate.doWrite(chunk); } Tomcat9CommitSessionOutputBuffer(final SessionCommitter sessionCommitter,
      final OutputBuffer delegate); @Override int doWrite(final ByteBuffer chunk); @Override long getBytesWritten();  }
@Test public void testDoWrite() throws IOException { final ByteBuffer byteBuffer = ByteBuffer.allocate(0); commitSesssionOutputBuffer.doWrite(byteBuffer); final InOrder inOrder = inOrder(sessionCommitter, delegate); inOrder.verify(sessionCommitter).commit(); inOrder.verify(delegate).doWrite(byteBuffer); inOrder.verifyNoMoreInteractions(); }