### Question:
TXIPv4Packet extends XBeeAPIPacket { public void setDestPort(int destPort) { if (destPort < 0 || destPort > 65535) throw new IllegalArgumentException(ERROR_PORT_ILLEGAL); this.destPort = destPort; } TXIPv4Packet(int frameID, Inet4Address destAddress, int destPort, int sourcePort,
			IPProtocol protocol, int transmitOptions, byte[] data); static TXIPv4Packet createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); Inet4Address getDestAddress(); void setDestAddress(Inet4Address destAddress); int getDestPort(); void setDestPort(int destPort); int getSourcePort(); void setSourcePort(int sourcePort); IPProtocol getProtocol(); void setProtocol(IPProtocol protocol); int getTransmitOptions(); void setTransmitOptions(int transmitOptions); byte[] getData(); void setData(byte[] data); @Override LinkedHashMap<String, String> getAPIPacketParameters(); static final int OPTIONS_CLOSE_SOCKET; static final int OPTIONS_LEAVE_SOCKET_OPEN; }### Answer:
@Test public final void testSetDestPortNegative() { TXIPv4Packet packet = new TXIPv4Packet(frameID, destAddress, destPort, sourcePort, protocol, transmitOptions, data); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Port must be between 0 and 65535."))); packet.setDestPort(-1); }
@Test public final void testSetDestPortBigger() { TXIPv4Packet packet = new TXIPv4Packet(frameID, destAddress, destPort, sourcePort, protocol, transmitOptions, data); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Port must be between 0 and 65535."))); packet.setDestPort(65536); }