### Question:
RX64IOPacket extends XBeeAPIPacket { public static RX64IOPacket createPacket(byte[] payload) { if (payload == null) throw new NullPointerException("RX64 Address IO packet payload cannot be null."); if (payload.length < MIN_API_PAYLOAD_LENGTH) throw new IllegalArgumentException("Incomplete RX64 Address IO packet."); if ((payload[0] & 0xFF) != APIFrameType.RX_IO_64.getValue()) throw new IllegalArgumentException("Payload is not a RX64 Address IO packet."); int index = 1; XBee64BitAddress sourceAddress64 = new XBee64BitAddress(Arrays.copyOfRange(payload, index, index + 8)); index = index + 8; int rssi = payload[index] & 0xFF; index = index + 1; int receiveOptions = payload[index] & 0xFF; index = index + 1; byte[] data = null; if (index < payload.length) data = Arrays.copyOfRange(payload, index, payload.length); return new RX64IOPacket(sourceAddress64, rssi, receiveOptions, data); } RX64IOPacket(XBee64BitAddress sourceAddress64, int rssi, int receiveOptions, byte[] rfData); static RX64IOPacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); XBee64BitAddress get64bitSourceAddress(); int getRSSI(); int getReceiveOptions(); IOSample getIOSample(); ArrayList<IOSample> getIOSamples(); void setRFData(byte[] rfData); byte[] getRFData(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("RX64 Address IO packet payload cannot be null."))); RX64IOPacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete RX64 Address IO packet."))); RX64IOPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadShorterThanNeeded() { int frameType = APIFrameType.RX_IO_64.getValue(); XBee64BitAddress source64Addr = new XBee64BitAddress("0013A2004032D9AB"); int rssi = 40; byte[] payload = new byte[10]; payload[0] = (byte)frameType; System.arraycopy(source64Addr.getValue(), 0, payload, 1, source64Addr.getValue().length); payload[9] = (byte)rssi; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete RX64 Address IO packet."))); RX64IOPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadNotIncludingFrameType() { XBee64BitAddress source64Addr = new XBee64BitAddress("0013A2004032D9AB"); int rssi = 40; int options = 0x01; byte[] data = new byte[]{(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF}; byte[] payload = new byte[10 + data.length]; System.arraycopy(source64Addr.getValue(), 0, payload, 0, source64Addr.getValue().length); payload[8] = (byte)rssi; payload[9] = (byte)options; System.arraycopy(data, 0, payload, 10, data.length); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a RX64 Address IO packet."))); RX64IOPacket.createPacket(payload); }