### Question:
XBeePacketsQueue { private boolean ipAddressesMatch(XBeePacket xbeePacket, Inet4Address ipAddress) { if (xbeePacket == null || ipAddress == null || !(xbeePacket instanceof XBeeAPIPacket)) return false; APIFrameType packetType = ((XBeeAPIPacket)xbeePacket).getFrameType(); switch (packetType) { case RX_IPV4: if (((RXIPv4Packet)xbeePacket).getSourceAddress().equals(ipAddress)) return true; break; default: return false; } return false; } XBeePacketsQueue();  XBeePacketsQueue(int maxLength); void addPacket(XBeePacket xbeePacket); void clearQueue(); XBeePacket getFirstPacket(int timeout); XBeePacket getFirstPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout); XBeePacket getFirstDataPacket(int timeout); XBeePacket getFirstDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout); XBeePacket getFirstExplicitDataPacket(int timeout); XBeePacket getFirstExplicitDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout); XBeePacket getFirstIPDataPacket(int timeout); XBeePacket getFirstIPv6DataPacket(int timeout); XBeePacket getFirstIPDataPacketFrom(Inet4Address ipAddress, int timeout); XBeePacket getFirstIPv6DataPacketFrom(Inet6Address ipv6Address, int timeout); int getMaxSize(); int getCurrentSize(); static final int DEFAULT_MAX_LENGTH; }### Answer:
@Test public void testIPAddressesMatch() throws Exception { ArrayList<XBeePacket> ipPackets = new ArrayList<XBeePacket>(); ipPackets.add(mockedRxIPv4Packet); XBeePacketsQueue xbeePacketsQueue = PowerMockito.spy(new XBeePacketsQueue()); Mockito.when(mockedRxIPv4Packet.getSourceAddress()).thenReturn(ipAddress1); for (XBeePacket packet:ipPackets) assertTrue((Boolean)Whitebox.invokeMethod(xbeePacketsQueue, METHOD_IP_ADDRESSES_MATCH, packet, ipAddress1)); Mockito.when(mockedRxIPv4Packet.getSourceAddress()).thenReturn(ipAddress2); for (XBeePacket packet:ipPackets) assertFalse((Boolean)Whitebox.invokeMethod(xbeePacketsQueue, METHOD_IP_ADDRESSES_MATCH, packet, ipAddress1)); }