ByteBufInput implements PackInput { public void start( ByteBuf newBuf ) { assertNotStarted(); buf = requireNonNull( newBuf ); }  void start( ByteBuf newBuf ); void stop(); @Override byte readByte(); @Override short readShort(); @Override int readInt(); @Override long readLong(); @Override double readDouble(); @Override void readBytes( byte[] into, int offset, int toRead ); @Override byte peekByte();  }
@Test void shouldThrowWhenStartedWithNullBuf() { ByteBufInput input = new ByteBufInput(); assertThrows( NullPointerException.class, () -> input.start( null ) ); }
@Test void shouldThrowWhenStartedTwice() { ByteBufInput input = new ByteBufInput(); input.start( mock( ByteBuf.class ) ); assertThrows( IllegalStateException.class, () -> input.start( mock( ByteBuf.class ) ) ); }