### Question:
EchoReplyMessageFactory extends VersionAssignableFactory implements OFDeserializer<EchoOutput> { @Override public EchoOutput deserialize(ByteBuf rawMessage) { EchoOutputBuilder builder = new EchoOutputBuilder(); builder.setVersion(getVersion()); builder.setXid(rawMessage.readUnsignedInt()); int remainingBytes = rawMessage.readableBytes(); if (remainingBytes > 0) { byte[] data = new byte[remainingBytes]; rawMessage.readBytes(data); builder.setData(data); } return builder.build(); }  @Override EchoOutput deserialize(ByteBuf rawMessage);  }### Answer:
@Test public void testWithEmptyDataField() { ByteBuf bb = BufferHelper.buildBuffer(); EchoOutput builtByFactory = BufferHelper.deserialize(factory, bb); Assert.assertArrayEquals("Wrong data", null, builtByFactory.getData()); }
@Test public void testWithDataFieldSet() { byte[] data = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; ByteBuf bb = BufferHelper.buildBuffer(data); EchoOutput builtByFactory = BufferHelper.deserialize(factory, bb); Assert.assertArrayEquals("Wrong data", data, builtByFactory.getData()); }