DiscardAllMessageEncoder implements MessageEncoder { @Override public void encode( Message message, ValuePacker packer ) throws IOException { checkArgument( message, DiscardAllMessage.class ); packer.packStructHeader( 0, DiscardAllMessage.SIGNATURE ); }  @Override void encode( Message message, ValuePacker packer );  }
@Test void shouldEncodeDiscardAllMessage() throws Exception { encoder.encode( DiscardAllMessage.DISCARD_ALL, packer ); verify( packer ).packStructHeader( 0, DiscardAllMessage.SIGNATURE ); }
@Test void shouldFailToEncodeWrongMessage() { assertThrows( IllegalArgumentException.class, () -> encoder.encode( new DiscardMessage( 100, 200 ), packer ) ); }