Serializer { protected final void appendByte(byte b) { outputStream.write(b); } Serializer(); final byte[] serialize(); ByteArrayOutputStream getOutputStream();  }
@Test public void testAppendByte() { serializer.appendByte((byte) 0x0); serializer.appendByte((byte) 0x1); byte[] result = serializer.getAlreadySerialized(); assertArrayEquals(result, new byte[] { 0, 1, }); }