### Question:
RXSMSPacket extends XBeeAPIPacket { @Override public LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("Phone number", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(phoneNumber)) + " (" + new String(phoneNumber).replaceAll("\0", "") + ")"); if (data != null) parameters.put("Data", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data.getBytes())) + " (" + data + ")"); return parameters; } RXSMSPacket(String phoneNumber, String data); static RXSMSPacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); void setPhoneNumber(String phoneNumber); byte[] getPhoneNumberByteArray(); String getPhoneNumber(); void setData(String data); String getData(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testGetAPIPacketParametersReceivedDataNull() { data = null; RXSMSPacket packet = new RXSMSPacket(phoneNumber, data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(1))); assertThat("Phone number is not the expected", packetParams.get("Phone number"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(Arrays.copyOf(phoneNumber.getBytes(), 20))) + " (" + new String(phoneNumber).replaceAll("\0", "") + ")"))); assertThat("Data is not the expected", packetParams.get("Data"), is(nullValue(String.class))); }
@Test public final void testGetAPIPacketParametersReceivedDataNotNull() { RXSMSPacket packet = new RXSMSPacket(phoneNumber, data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(2))); assertThat("Phone number is not the expected", packetParams.get("Phone number"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(Arrays.copyOf(phoneNumber.getBytes(), 20))) + " (" + new String(phoneNumber).replaceAll("\0", "") + ")"))); assertThat("Data is not the expected", packetParams.get("Data"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data.getBytes())) + " (" + data + ")"))); }