### Question:
FrameErrorPacket extends XBeeAPIPacket { public static FrameErrorPacket 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.FRAME_ERROR.getValue()) throw new IllegalArgumentException(ERROR_NOT_VALID); int index = 1; FrameError error = FrameError.get(payload[index] & 0xFF); return new FrameErrorPacket(error); } FrameErrorPacket(FrameError error); static FrameErrorPacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); void setError(FrameError error); FrameError getError(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Frame Error packet payload cannot be null."))); FrameErrorPacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Frame Error packet."))); FrameErrorPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadShorterThanNeeded() { byte[] payload = new byte[1]; payload[0] = (byte)error.getID(); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete Frame Error packet."))); FrameErrorPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadNotIncludingFrameType() { byte[] payload = new byte[2]; payload[0] = (byte)error.getID(); payload[1] = (byte)error.getID(); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a Frame Error packet."))); FrameErrorPacket.createPacket(payload); }