### Question:
LLDP extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { ByteBuffer bb = ByteBuffer.wrap(data, offset, length); LLDPTLV tlv; do { tlv = new LLDPTLV().deserialize(bb); if (tlv == null) break; switch (tlv.getType()) { case 0x0: break; case 0x1: this.chassisId = tlv; break; case 0x2: this.portId = tlv; break; case 0x3: this.ttl = tlv; break; default: this.optionalTLVList.add(tlv); break; } } while (tlv.getType() != 0 && bb.hasRemaining()); return this; } LLDP(); LLDPTLV getChassisId(); LLDP setChassisId(LLDPTLV chassisId); LLDPTLV getPortId(); LLDP setPortId(LLDPTLV portId); LLDPTLV getTtl(); LLDP setTtl(LLDPTLV ttl); List<LLDPTLV> getOptionalTLVList(); LLDP setOptionalTLVList(List<LLDPTLV> optionalTLVList); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testDeserialize() throws Exception { Ethernet ethernet = (Ethernet) new Ethernet().deserialize(pkt, 0, pkt.length); ethernet.setPad(true); assertTrue(Arrays.equals(pkt, ethernet.serialize())); IPacket expected = getPacket(); assertEquals(expected, ethernet); }