### Question:
IODataSampleRxIndicatorPacket extends XBeeAPIPacket { public byte[] getRFData() { if (rfData == null) return null; return Arrays.copyOf(rfData, rfData.length); } IODataSampleRxIndicatorPacket(XBee64BitAddress sourceAddress64, XBee16BitAddress sourceAddress16, int receiveOptions, byte[] rfData); static IODataSampleRxIndicatorPacket createPacket(byte[] payload); @Override boolean needsAPIFrameID(); @Override boolean isBroadcast(); XBee64BitAddress get64bitSourceAddress(); XBee16BitAddress get16bitSourceAddress(); int getReceiveOptions(); IOSample getIOSample(); void setRFData(byte[] rfData); byte[] getRFData(); @Override LinkedHashMap<String, String> getAPIPacketParameters();  }### Answer:
@Test public final void testGetRFDataNullData() { XBee64BitAddress source64Addr = new XBee64BitAddress("0013A2004032D9AB"); XBee16BitAddress source16Addr = new XBee16BitAddress("D817"); int options = 0x46; byte[] receivedData = null; IODataSampleRxIndicatorPacket packet = new IODataSampleRxIndicatorPacket(source64Addr, source16Addr, options, receivedData); byte[] result = packet.getRFData(); assertThat("RF Data must be the same", result, is(equalTo(receivedData))); assertThat("RF Data must be null", result, is(nullValue(byte[].class))); }
@Test public final void testGetRFDataInvalidData() { XBee64BitAddress source64Addr = new XBee64BitAddress("0013A2004032D9AB"); XBee16BitAddress source16Addr = new XBee16BitAddress("D817"); int options = 0x46; byte[] receivedData = new byte[]{0x68, 0x6F, 0x6C, 0x61}; IODataSampleRxIndicatorPacket packet = new IODataSampleRxIndicatorPacket(source64Addr, source16Addr, options, receivedData); byte[] result = packet.getRFData(); assertThat("RF Data must be the same", result, is(equalTo(receivedData))); assertThat("RF Data must not be the same object", result.hashCode(), is(not(equalTo(receivedData.hashCode())))); }
@Test public final void testGetRFDataValidData() { XBee64BitAddress source64Addr = new XBee64BitAddress("0013A2004032D9AB"); XBee16BitAddress source16Addr = new XBee16BitAddress("D817"); int options = 0x46; byte[] receivedData = new byte[]{0x68, 0x6F, 0x6C, 0x61, (byte)0x98, 0x11, 0x32}; IODataSampleRxIndicatorPacket packet = new IODataSampleRxIndicatorPacket(source64Addr, source16Addr, options, receivedData); byte[] result = packet.getRFData(); assertThat("RF Data must be the same", result, is(equalTo(receivedData))); assertThat("RF Data must not be the same object", result.hashCode(), is(not(equalTo(receivedData.hashCode())))); }