### Question:
TX64Packet extends XBeeAPIPacket { @Override public LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("64-bit dest. address", HexUtils.prettyHexString(destAddress64.toString())); parameters.put("Options", HexUtils.prettyHexString(HexUtils.integerToHexString(transmitOptions, 1))); if (rfData != null) parameters.put("RF data", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(rfData))); return parameters; } TX64Packet(int frameID, XBee64BitAddress destAddress64, int transmitOptions, byte[] rfData); static TX64Packet createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); XBee64BitAddress get64bitDestinationAddress(); int getTransmitOptions(); void setRFData(byte[] rfData); byte[] getRFData(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testGetAPIPacketParametersReceivedDataNull() { int frameID = 0x65; XBee64BitAddress dest64Addr = new XBee64BitAddress("0013A2004032D9AB"); int options = 40; byte[] data = null; TX64Packet packet = new TX64Packet(frameID, dest64Addr, options, data); String expectedDest64Addr = HexUtils.prettyHexString(dest64Addr.getValue()); String expectedOptions = HexUtils.prettyHexString(Integer.toHexString(options)); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(2))); assertThat("Destination 64-bit Address is not the expected one", packetParams.get("64-bit dest. address"), is(equalTo(expectedDest64Addr))); assertThat("Transmit options are not the expected", packetParams.get("Options"), is(equalTo(expectedOptions))); assertThat("Data is not the expected", packetParams.get("RF data"), is(nullValue(String.class))); }
@Test public final void testGetAPIPacketParametersReceivedDataNotNull() { int frameID = 0x65; XBee64BitAddress dest64Addr = new XBee64BitAddress("0013A2004032D9AB"); int options = 40; byte[] data = new byte[]{0x68, 0x6F, 0x6C, 0x61}; TX64Packet packet = new TX64Packet(frameID, dest64Addr, options, data); String expectedDest64Addr = HexUtils.prettyHexString(dest64Addr.getValue()); String expectedOptions = HexUtils.prettyHexString(Integer.toHexString(options)); String expectedData = HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data)); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(3))); assertThat("Destination 64-bit Address is not the expected one", packetParams.get("64-bit dest. address"), is(equalTo(expectedDest64Addr))); assertThat("Receive options are not the expected", packetParams.get("Options"), is(equalTo(expectedOptions))); assertThat("Data is not the expected", packetParams.get("RF data"), is(equalTo(expectedData))); }