ChunkAwareByteBufOutput implements PackOutput { public void start( ByteBuf newBuf ) { assertNotStarted(); buf = requireNonNull( newBuf ); startNewChunk( 0 ); } ChunkAwareByteBufOutput();   ChunkAwareByteBufOutput( int maxChunkSize ); void start( ByteBuf newBuf ); void stop(); @Override PackOutput writeByte( byte value ); @Override PackOutput writeBytes( byte[] data ); @Override PackOutput writeShort( short value ); @Override PackOutput writeInt( int value ); @Override PackOutput writeLong( long value ); @Override PackOutput writeDouble( double value );  }
@Test void shouldThrowWhenStartedWithNullBuf() { ChunkAwareByteBufOutput output = new ChunkAwareByteBufOutput( 16 ); assertThrows( NullPointerException.class, () -> output.start( null ) ); }
@Test void shouldThrowWhenStartedTwice() { ChunkAwareByteBufOutput output = new ChunkAwareByteBufOutput( 16 ); output.start( mock( ByteBuf.class ) ); assertThrows( IllegalStateException.class, () -> output.start( mock( ByteBuf.class ) ) ); }