### Question:
DeviceResponsePacket extends XBeeAPIPacket { @Override public LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("Device Request ID", HexUtils.prettyHexString(HexUtils.integerToHexString(requestID, 1)) + " (" + requestID + ")"); parameters.put("Reserved", "00"); if (responseData != null) parameters.put("Data", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(responseData))); return parameters; } DeviceResponsePacket(int frameID, int requestID, byte[] responseData); static DeviceResponsePacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); void setRequestID(int requestID); int getRequestID(); void setResponseData(byte[] responseData); byte[] getResponseData(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testGetAPIPacketParametersDataNull() { data = null; DeviceResponsePacket packet = new DeviceResponsePacket(frameID, requestID, data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(2))); assertThat("Returned request ID is not the expected one", packetParams.get("Device Request ID"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(requestID, 1)) + " (" + requestID + ")"))); assertThat("Returned reserved is not the expected one", packetParams.get("Reserved"), is("00")); assertThat("Returned data is not the expected one", packetParams.get("RF data"), is(nullValue())); }
@Test public final void testGetAPIPacketParametersDataNotNull() { DeviceResponsePacket packet = new DeviceResponsePacket(frameID, requestID, data); LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(3))); assertThat("Returned request ID is not the expected one", packetParams.get("Device Request ID"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(requestID, 1)) + " (" + requestID + ")"))); assertThat("Returned reserved is not the expected one", packetParams.get("Reserved"), is("00")); assertThat("Returned data is not the expected one", packetParams.get("Data"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))))); }