### Question:
ICMP extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) throws PacketParsingException { ByteBuffer bb = ByteBuffer.wrap(data, offset, length); this.icmpType = bb.get(); this.icmpCode = bb.get(); this.checksum = bb.getShort(); short padding = 0; if (paddingMap.containsKey(this.icmpType)) padding = paddingMap.get(this.icmpType); bb.position(bb.position() + padding); this.payload = new Data(); this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position()); this.payload.setParent(this); return this; }  byte getIcmpType(); ICMP setIcmpType(byte icmpType); byte getIcmpCode(); ICMP setIcmpCode(byte icmpCode); short getChecksum(); ICMP setChecksum(short checksum); @Override byte[] serialize(); @Override int hashCode(); @Override boolean equals(Object obj); @Override IPacket deserialize(byte[] data, int offset, int length); static final Map<Byte, Short> paddingMap; static final byte ECHO_REPLY; static final byte ECHO_REQUEST; static final byte TIME_EXCEEDED; static final byte DESTINATION_UNREACHABLE; static final byte CODE_PORT_UNREACHABLE; }### Answer:
@Test public void testDeserialize() throws Exception { IPacket packet = new IPv4(); packet.deserialize(pktSerialized, 0, pktSerialized.length); byte[] pktSerialized1 = packet.serialize(); assertTrue(Arrays.equals(pktSerialized, pktSerialized1)); }