### Question:
GenericXBeePacket extends XBeeAPIPacket { @Override protected LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); if (rfData != null) parameters.put("RF Data", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(rfData))); return parameters; } GenericXBeePacket(byte[] rfData); static GenericXBeePacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); void setRFData(byte[] rfData); byte[] getRFData(); @Override boolean isBroadcast();  }### Answer:
@Test public final void testGetAPIPacketParametersNullData() { byte[] data = null; GenericXBeePacket packet = new GenericXBeePacket(data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(0))); assertThat("RF Data is not the expected one", packetParams.get("RF Data"), is(nullValue(String.class))); }
@Test public final void testGetAPIPacketParametersNotNullData() { byte[] data = new byte[]{0x68, 0x6F, 0x6C, 0x61};; GenericXBeePacket packet = new GenericXBeePacket(data); String expectedData = HexUtils.prettyHexString(data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(1))); assertThat("RF Data is not the expected one", packetParams.get("RF Data"), is(equalTo(expectedData))); }