ReactiveFlowWriter implements ArpPacketListener { public void writeFlows(NodeConnectorRef ingress, MacAddress srcMac, MacAddress destMac) { NodeConnectorRef destNodeConnector = inventoryReader .getNodeConnector(ingress.getValue().firstIdentifierOf(Node.class), destMac); if (destNodeConnector != null) { flowWriterService.addBidirectionalMacToMacFlows(srcMac, ingress, destMac, destNodeConnector); } } ReactiveFlowWriter(InventoryReader inventoryReader, FlowWriterService flowWriterService); @Override void onArpPacketReceived(ArpPacketReceived packetReceived); void writeFlows(NodeConnectorRef ingress, MacAddress srcMac, MacAddress destMac);  }
@Test public void writeFlowsTest() { when(inventoryReader.getNodeConnector(any(InstanceIdentifier.class), any(MacAddress.class))) .thenReturn(destNodeConnectorRef); reactiveFlowWriter.writeFlows(nodeConnectorRef, new MacAddress("00:00:00:00:00:01"), new MacAddress("00:00:00:00:00:02")); verify(inventoryReader, times(1)).getNodeConnector(any(InstanceIdentifier.class), any(MacAddress.class)); verify(flowWriterService, times(1)).addBidirectionalMacToMacFlows(any(MacAddress.class), any(NodeConnectorRef.class), any(MacAddress.class), any(NodeConnectorRef.class)); }