### Question:
XBeeAPIPacket extends XBeePacket { public void setFrameID(int frameID) { if (frameID < 0 || frameID > 255) throw new IllegalArgumentException("Frame ID must be between 0 and 255."); if (needsAPIFrameID()) this.frameID = frameID; } protected  XBeeAPIPacket(APIFrameType frameType); protected  XBeeAPIPacket(int frameTypeValue); APIFrameType getFrameType(); int getFrameTypeValue(); @Override byte[] getPacketData(); byte[] getAPIData(); abstract boolean needsAPIFrameID(); int getFrameID(); void setFrameID(int frameID); abstract boolean isBroadcast(); boolean checkFrameID(int id); final static int NO_FRAME_ID; }### Answer:
@Test public final void testSetFrameIDBiggerThan255() { int frameID = 300; TestXBeeAPIPacket packet = new TestXBeeAPIPacket(APIFrameType.GENERIC); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Frame ID must be between 0 and 255."))); packet.setFrameID(frameID); }
@Test public final void testSetFrameIDNegative() { int frameID = -1; TestXBeeAPIPacket packet = new TestXBeeAPIPacket(APIFrameType.GENERIC); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Frame ID must be between 0 and 255."))); packet.setFrameID(frameID); }