### Question:
IPv6RemoteATCommandRequestPacket extends XBeeAPIPacket { public static IPv6RemoteATCommandRequestPacket 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.IPV6_REMOTE_AT_COMMAND_REQUEST.getValue()) throw new IllegalArgumentException(ERROR_NOT_REMOTE_IPV6_REQ); int index = 1; int frameID = payload[index] & 0xFF; index = index + 1; Inet6Address destAddress; try { destAddress = (Inet6Address) Inet6Address.getByAddress(Arrays.copyOfRange(payload, index, index + 16)); } catch (UnknownHostException e) { throw new IllegalArgumentException(e); } index = index + 16; int transmitOptions = payload[index] & 0xFF; index = index + 1; String command = new String(new byte[]{payload[index], payload[index + 1]}); index = index + 2; byte[] parameterData = null; if (index < payload.length) parameterData = Arrays.copyOfRange(payload, index, payload.length); return new IPv6RemoteATCommandRequestPacket(frameID, destAddress, transmitOptions, command, parameterData); } IPv6RemoteATCommandRequestPacket(int frameID, Inet6Address destAddress, 
			int transmitOptions, String command, String parameter);  IPv6RemoteATCommandRequestPacket(int frameID, Inet6Address destAddress, 
			int transmitOptions, String command, byte[] parameter); static IPv6RemoteATCommandRequestPacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); Inet6Address getDestAddress(); int getTransmitOptions(); String getCommand(); void setParameter(String parameter); void setParameter(byte[] parameter); byte[] getParameter(); String getParameterAsString(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testCreatePacketNullPayload() { byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("IPv6 Remote AT command packet payload cannot be null."))); IPv6RemoteATCommandRequestPacket.createPacket(payload); }
@Test public final void testCreatePacketEmptyPayload() { byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete IPv6 Remote AT command packet."))); IPv6RemoteATCommandRequestPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadShorterThanNeeded() { String cmd = "A"; byte[] payload = new byte[19 + cmd.getBytes().length]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; System.arraycopy(ipv6address.getAddress(), 0, payload, 2, ipv6address.getAddress().length); payload[18] = (byte)transmitOptions; System.arraycopy(cmd.getBytes(), 0, payload, 19, cmd.getBytes().length); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete IPv6 Remote AT command packet."))); IPv6RemoteATCommandRequestPacket.createPacket(payload); }
@Test public final void testCreatePacketPayloadNotIncludingFrameType() { byte[] payload = new byte[20 + parameter.length]; payload[0] = (byte)frameID; System.arraycopy(ipv6address.getAddress(), 0, payload, 1, ipv6address.getAddress().length); payload[17] = (byte)transmitOptions; System.arraycopy(command.getBytes(), 0, payload, 18, command.getBytes().length); System.arraycopy(parameter, 0, payload, 20, parameter.length); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not an IPv6 Remote AT command packet."))); IPv6RemoteATCommandRequestPacket.createPacket(payload); }