### Question:
SendDataResponsePacket extends XBeeAPIPacket { public static SendDataResponsePacket createPacket(byte[] payload) { if (payload == null) throw new NullPointerException(ERROR_PAYLOAD_NULL); if (payload.length < MIN_API_PAYLOAD_LENGTH) throw new IllegalArgumentException(ERROR_INCOMPLETE_PACKET); if ((payload[0] & 0xFF) != APIFrameType.SEND_DATA_RESPONSE.getValue()) throw new IllegalArgumentException(ERROR_NOT_VALID); int index = 1; int frameID = payload[index] & 0xFF; index = index + 1; DeviceCloudStatus status = DeviceCloudStatus.get(payload[index] & 0xFF); return new SendDataResponsePacket(frameID, status); } SendDataResponsePacket(int frameID, DeviceCloudStatus status); static SendDataResponsePacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); void setStatus(DeviceCloudStatus status); DeviceCloudStatus getStatus(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Send Data Response packet payload cannot be null."))); SendDataResponsePacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Send Data Response packet."))); SendDataResponsePacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadShorterThanNeeded() { byte[] payload = new byte[2]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Send Data Response packet."))); SendDataResponsePacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadNotIncludingFrameType() { byte[] payload = new byte[3]; payload[0] = (byte)frameID; payload[1] = (byte)status.getID(); payload[2] = (byte)status.getID(); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a Send Data Response packet."))); SendDataResponsePacket.createPacket(payload); }