@Test
public void testGetNodeConnector() throws Exception {

    List<Addresses> addressesList = new ArrayList<Addresses>();
    addressesList.add(new AddressesBuilder().setLastSeen(0L).setMac(new MacAddress("aa:bb:cc:dd:ee:ff")).build());
    AddressCapableNodeConnector addressCapableNodeConnector = new AddressCapableNodeConnectorBuilder()
            .setAddresses(addressesList).build();
    StpStatusAwareNodeConnector stpStatusAwareNodeConnector = new StpStatusAwareNodeConnectorBuilder()
            .setStatus(StpStatus.Forwarding).build();
    NodeConnector nodeConnector = new NodeConnectorBuilder()
            .addAugmentation(StpStatusAwareNodeConnector.class, stpStatusAwareNodeConnector)
            .addAugmentation(AddressCapableNodeConnector.class, addressCapableNodeConnector).build();
    List<NodeConnector> nodeConnectors = new ArrayList<NodeConnector>();
    nodeConnectors.add(nodeConnector);
    Node node = new NodeBuilder().setNodeConnector(nodeConnectors).build();
    Optional<Node> optionalNode = Optional.of(node);
    ReadOnlyTransaction readOnlyTransaction = Mockito.mock(ReadOnlyTransaction.class);
    CheckedFuture checkedFuture = Mockito.mock(CheckedFuture.class);
    when(checkedFuture.get()).thenReturn(optionalNode);
    when(readOnlyTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
            .thenReturn(checkedFuture);
    when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
    assertNotNull(
            inventoryReader
                    .getNodeConnector(
                            InstanceIdentifier.builder(Nodes.class)
                                    .child(Node.class, new NodeKey(new NodeId("openflow:1"))).build(),
                            new MacAddress("aa:bb:cc:dd:ee:ff")));
    verify(readOnlyTransaction, times(1)).close();
}