### Question:
InventoryHelper { public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; }  static Long getLongFromDpid(String dpid); static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge,
            InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker); static String getInventoryNodeConnectorIdString(String inventoryNodeId,
            OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid,
            DataBroker dataBroker); static boolean checkOfOverlayConfig(String nodeIdString, List<AbstractTunnelType> requiredTunnelTypes,
            DataBroker dataBroker); static InstanceIdentifier<ExternalInterfaces> addOfOverlayExternalPort(NodeId nodeId, NodeConnectorId ncId,
        DataBroker dataBroker); static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker); static void updateOfOverlayConfig(IpAddress ip, String nodeIdString, String nodeConnectorIdString,
            AbstractTunnelType tunnelType, DataBroker dataBroker); static void removeTunnelsOfOverlayConfig(String nodeIdString,
                                                    List<AbstractTunnelType> tunnels,
                                                    DataBroker dataBroker);  }### Answer:
@Test public void testGetInventoryNodeIdString() throws Exception { OvsdbBridgeAugmentation ovsdbBridge = mock(OvsdbBridgeAugmentation.class); DatapathId datapathId = mock(DatapathId.class); when(ovsdbBridge.getDatapathId()).thenReturn(datapathId); when(datapathId.getValue()).thenReturn("FF:FF:FF:FF:FF:FF:FF:FF"); String result = InventoryHelper.getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker); assertEquals("openflow:281474976710655", result); }
@SuppressWarnings("unchecked") @Test public void testGetInventoryNodeIdString_DpidNull() throws Exception { OvsdbBridgeAugmentation ovsdbBridge = mock(OvsdbBridgeAugmentation.class); when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))) .thenReturn(bridgeFuture); when(bridgeOptional.isPresent()).thenReturn(true); OvsdbBridgeAugmentation bridge = mock(OvsdbBridgeAugmentation.class); when(bridgeOptional.get()).thenReturn(bridge); when(bridge.getDatapathId()).thenReturn(null); String result = InventoryHelper.getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker); assertNull(result); }