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