CommitMessageEncoder implements MessageEncoder { @Override public void encode( Message message, ValuePacker packer ) throws IOException { checkArgument( message, CommitMessage.class ); packer.packStructHeader( 0, CommitMessage.SIGNATURE ); }  @Override void encode( Message message, ValuePacker packer );  }
@Test void shouldEncodeCommitMessage() throws Exception { encoder.encode( COMMIT, packer ); verify( packer ).packStructHeader( 0, CommitMessage.SIGNATURE ); }
@Test void shouldFailToEncodeWrongMessage() { assertThrows( IllegalArgumentException.class, () -> encoder.encode( DISCARD_ALL, packer ) ); }