IidFactory { public static NodeRef createNodeRef(InstanceIdentifier<?> path) { final InstanceIdentifier<Node> nodePath = Preconditions.checkNotNull(path.firstIdentifierOf(Node.class)); return new NodeRef(nodePath); }  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 createNodeRefTest() throws Exception { NodeKey mockNodeKey = mock(NodeKey.class); InstanceIdentifier<?> iid = InstanceIdentifier.builder(Nodes.class).child(Node.class, mockNodeKey).build(); NodeRef nodeRef = new NodeRef(iid); assertEquals(nodeRef, IidFactory.createNodeRef(iid)); }