### Question:
GenericXBeePacket extends XBeeAPIPacket { public static GenericXBeePacket createPacket(byte[] payload) { if (payload == null) throw new NullPointerException("Generic packet payload cannot be null."); if (payload.length < MIN_API_PAYLOAD_LENGTH) throw new IllegalArgumentException("Incomplete Generic packet."); if ((payload[0] & 0xFF) != APIFrameType.GENERIC.getValue()) throw new IllegalArgumentException("Payload is not a Generic packet."); int index = 1; byte[] commandData = null; if (index < payload.length) commandData = Arrays.copyOfRange(payload, index, payload.length); return new GenericXBeePacket(commandData); } GenericXBeePacket(byte[] rfData); static GenericXBeePacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); void setRFData(byte[] rfData); byte[] getRFData(); @Override boolean isBroadcast();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Generic packet payload cannot be null."))); GenericXBeePacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Generic packet."))); GenericXBeePacket.createPacket(payload); }
@Test public final void testCreatePacketInvalidFrameType() { int frameType = 0x13; byte[] payload = new byte[1]; payload[0] = (byte)frameType; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a Generic packet."))); GenericXBeePacket.createPacket(payload); }