//Given
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[]{5});
ByteCodec codec = new ByteCodec();
//When
ByteBuffer encoded = codec.encode((byte) 3);
Byte decoded = codec.decode(byteBuffer);
//Then
assertThat(encoded.array()[0]).isEqualTo((byte)3);
assertThat(decoded).isEqualTo(new Byte((byte)5));