IidFactory { public static NodeId getNodeId(InstanceIdentifier<?> path) { final NodeKey nodeKey = Preconditions.checkNotNull(path.firstKeyOf(Node.class)); return nodeKey.getId(); }  static InstanceIdentifier<Node> getNodeWildII(); static InstanceIdentifier<Node> getNodeII(final InstanceIdentifier<?> ii); static NodeRef createNodeRef(InstanceIdentifier<?> path); static NodeId getNodeId(InstanceIdentifier<?> path); static InstanceIdentifier<Link> getLinkWildII(); static InstanceIdentifier<Link> getLinkII(final InstanceIdentifier<?> path); static InstanceIdentifier<Topology> getFlowTopologyII();  }
@Test public void getNodeIdTest() throws Exception { NodeKey mockNodeKey = mock(NodeKey.class); InstanceIdentifier<?> iid = InstanceIdentifier.builder(Nodes.class).child(Node.class, mockNodeKey).build(); assertEquals(mockNodeKey.getId(), IidFactory.getNodeId(iid)); }