### Question:
OvsdbControllerUpdateCommand extends AbstractTransactionCommand { @VisibleForTesting InstanceIdentifier<ControllerEntry> getControllerEntryIid( final ControllerEntry controllerEntry, final String bridgeName) { OvsdbConnectionInstance client = getOvsdbConnectionInstance(); String nodeString = client.getNodeKey().getNodeId().getValue() + "/bridge/" + bridgeName; NodeId nodeId = new NodeId(new Uri(nodeString)); NodeKey nodeKey = new NodeKey(nodeId); InstanceIdentifier<Node> bridgeIid = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class,nodeKey) .build(); return bridgeIid .augmentation(OvsdbBridgeAugmentation.class) .child(ControllerEntry.class, controllerEntry.key()); } OvsdbControllerUpdateCommand(final OvsdbConnectionInstance key,
            final TableUpdates updates, final DatabaseSchema dbSchema); @Override void execute(final ReadWriteTransaction transaction);  }### Answer:
@SuppressWarnings("unchecked") @Test public void testUpdateController1() throws Exception { Map<UUID, Bridge> updatedBridgeRows = new HashMap<>(); Bridge bridge = mock(Bridge.class); updatedBridgeRows.put(mock(UUID.class), bridge); PowerMockito.mockStatic(SouthboundMapper.class); List<ControllerEntry> controllerEntries = new ArrayList<>(); controllerEntries.add(mock(ControllerEntry.class)); when(SouthboundMapper.createControllerEntries(any(Bridge.class), any(Map.class))).thenReturn(controllerEntries); Column<GenericTableSchema, String> column = mock(Column.class); when(bridge.getNameColumn()).thenReturn(column); when(column.getData()).thenReturn(BRIDGE_NAME); ReadWriteTransaction transaction = mock(ReadWriteTransaction.class); Map<UUID, Controller> updatedControllerRows = new HashMap<>(); doReturn(mock(InstanceIdentifier.class)).when(ovsdbControllerUpdateCommand).getControllerEntryIid( any(ControllerEntry.class), any(String.class)); doNothing().when(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(ControllerEntry.class)); Whitebox.invokeMethod(ovsdbControllerUpdateCommand, "updateController", transaction, updatedControllerRows, updatedBridgeRows); verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(ControllerEntry.class)); verify(bridge).getNameColumn(); }
@Test public void testGetControllerEntryIid() throws Exception { ControllerEntry controllerEntry = mock(ControllerEntry.class); OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class); when(ovsdbControllerUpdateCommand.getOvsdbConnectionInstance()).thenReturn(client); NodeKey nodeKey = mock(NodeKey.class); when(client.getNodeKey()).thenReturn(nodeKey); NodeId nodeId = mock(NodeId.class); when(nodeKey.getNodeId()).thenReturn(nodeId); when(nodeId.getValue()).thenReturn(NODE_ID); PowerMockito.whenNew(Uri.class).withAnyArguments().thenReturn(mock(Uri.class)); PowerMockito.whenNew(NodeId.class).withAnyArguments().thenReturn(nodeId); PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(nodeKey); PowerMockito.whenNew(TopologyKey.class).withAnyArguments().thenReturn(mock(TopologyKey.class)); when(controllerEntry.key()).thenReturn(mock(ControllerEntryKey.class)); assertEquals(KeyedInstanceIdentifier.class, Whitebox .invokeMethod(ovsdbControllerUpdateCommand, "getControllerEntryIid", controllerEntry, BRIDGE_NAME) .getClass()); }