### Question:
ModemStatusPacket extends XBeeAPIPacket { public static ModemStatusPacket createPacket(byte[] payload) { if (payload == null) throw new NullPointerException("Modem Status packet payload cannot be null."); if (payload.length < MIN_API_PAYLOAD_LENGTH) throw new IllegalArgumentException("Incomplete Modem Status packet."); if ((payload[0] & 0xFF) != APIFrameType.MODEM_STATUS.getValue()) throw new IllegalArgumentException("Payload is not a Modem Status packet."); int status = payload[1] & 0xFF; ModemStatusEvent modemStatusEvent = ModemStatusEvent.get(status); return new ModemStatusPacket(modemStatusEvent); } ModemStatusPacket(ModemStatusEvent modemStatusEvent); static ModemStatusPacket createPacket(byte[] payload); @Override byte[] getAPIPacketSpecificData(); @Override boolean needsAPIFrameID(); ModemStatusEvent getStatus(); @Override boolean isBroadcast(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Modem Status packet payload cannot be null."))); ModemStatusPacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Modem Status packet."))); ModemStatusPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadShorterThanNeeded() { int frameType = APIFrameType.MODEM_STATUS.getValue(); byte[] payload = new byte[1]; payload[0] = (byte)frameType; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Modem Status packet."))); ModemStatusPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadInvalidFrameType() { int frameType = APIFrameType.TRANSMIT_REQUEST.getValue(); ModemStatusEvent modemStatusEvent = ModemStatusEvent.STATUS_JOINED_NETWORK; byte[] payload = new byte[2]; payload[0] = (byte)frameType; payload[1] = (byte)modemStatusEvent.getId(); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a Modem Status packet."))); ModemStatusPacket.createPacket(payload); }