### Question:
XBeePacket { @Override public boolean equals(Object obj) { if (!(obj instanceof XBeePacket)) return false; XBeePacket packet = (XBeePacket)obj; return Arrays.equals(packet.generateByteArray(), generateByteArray()); } protected  XBeePacket(); byte[] generateByteArray(); byte[] generateByteArrayEscaped(); abstract byte[] getPacketData(); int getPacketLength(); int getChecksum(); LinkedHashMap<String, String> getParameters(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); String toPrettyString(); static XBeePacket parsePacket(String packet, OperatingMode mode); static XBeePacket parsePacket(byte[] packet, OperatingMode mode);  }### Answer:
@Test public final void testEqualsWithNull() { final byte[] dataArray = new byte[]{0x17, 0x01, 0x00, 0x13, (byte)0xA2, 0x00, 0x40, (byte)0xAD, 0x14, 0x2E, (byte)0xFF, (byte)0xFE, 0x02, 0x4E, 0x49}; TestXBeePacket packet = new TestXBeePacket() { public byte[] getPacketData() { return dataArray; } }; boolean areEqual = packet.equals(null); assertThat("Packet cannot be equal to null", areEqual, is(equalTo(false))); }
@Test public final void testEqualsWithNonXBeePacket() { final byte[] dataArray = new byte[]{0x17, 0x01, 0x00, 0x13, (byte)0xA2, 0x00, 0x40, (byte)0xAD, 0x14, 0x2E, (byte)0xFF, (byte)0xFE, 0x02, 0x4E, 0x49}; TestXBeePacket packet = new TestXBeePacket() { public byte[] getPacketData() { return dataArray; } }; boolean areEqual = packet.equals(new Object()); assertThat("Packet cannot be equal to an Object", areEqual, is(equalTo(false))); }