### Question:
OvsdbBridgeUpdateCommand extends AbstractTransactionCommand { private Node buildConnectionNode( Bridge bridge) { NodeBuilder connectionNode = new NodeBuilder(); connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId()); OvsdbNodeAugmentationBuilder ovsdbConnectionAugmentationBuilder = new OvsdbNodeAugmentationBuilder(); List<ManagedNodeEntry> managedBridges = new ArrayList<>(); InstanceIdentifier<Node> bridgeIid = SouthboundMapper.createInstanceIdentifier(instanceIdentifierCodec, getOvsdbConnectionInstance(), bridge); ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder().setBridgeRef( new OvsdbBridgeRef(bridgeIid)).build(); managedBridges.add(managedBridge); ovsdbConnectionAugmentationBuilder.setManagedNodeEntry(managedBridges); connectionNode.addAugmentation(ovsdbConnectionAugmentationBuilder.build()); LOG.debug("Update node with bridge node ref {}", ovsdbConnectionAugmentationBuilder.getManagedNodeEntry().values().iterator().next()); return connectionNode.build(); } OvsdbBridgeUpdateCommand(InstanceIdentifierCodec instanceIdentifierCodec, OvsdbConnectionInstance key,
            TableUpdates updates, DatabaseSchema dbSchema,
                                    Map<NodeId, Node> updatedBridgeNodes); @Override void execute(ReadWriteTransaction transaction); @Override void onSuccess(); @Override void onFailure(Throwable throwable);  }### Answer:
@SuppressWarnings("unchecked") @Test public void testBuildConnectionNode() throws Exception { NodeBuilder connectionNode = mock(NodeBuilder.class); PowerMockito.whenNew(NodeBuilder.class).withNoArguments().thenReturn(connectionNode); OvsdbConnectionInstance ovsdbConnectionInstance = mock(OvsdbConnectionInstance.class); when(ovsdbBridgeUpdateCommand.getOvsdbConnectionInstance()).thenReturn(ovsdbConnectionInstance); when(ovsdbConnectionInstance.getNodeId()).thenReturn(mock(NodeId.class)); when(connectionNode.setNodeId(any(NodeId.class))).thenReturn(connectionNode); OvsdbNodeAugmentationBuilder ovsdbConnectionAugmentationBuilder = mock(OvsdbNodeAugmentationBuilder.class); PowerMockito.whenNew(OvsdbNodeAugmentationBuilder.class).withNoArguments() .thenReturn(ovsdbConnectionAugmentationBuilder); PowerMockito.mockStatic(SouthboundMapper.class); InstanceIdentifier<Node> bridgeIid = mock(InstanceIdentifier.class); when(SouthboundMapper.createInstanceIdentifier(any(InstanceIdentifierCodec.class), any(OvsdbConnectionInstance.class), any(Bridge.class))) .thenReturn(bridgeIid); ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder() .setBridgeRef(new OvsdbBridgeRef(mock(InstanceIdentifier.class))) .build(); ManagedNodeEntryBuilder managedNodeEntryBuilder = mock(ManagedNodeEntryBuilder.class); PowerMockito.whenNew(ManagedNodeEntryBuilder.class).withNoArguments().thenReturn(managedNodeEntryBuilder); PowerMockito.whenNew(OvsdbBridgeRef.class).withAnyArguments().thenReturn(mock(OvsdbBridgeRef.class)); when(managedNodeEntryBuilder.setBridgeRef(any(OvsdbBridgeRef.class))).thenReturn(managedNodeEntryBuilder); when(managedNodeEntryBuilder.build()).thenReturn(managedBridge); when(ovsdbConnectionAugmentationBuilder.setManagedNodeEntry(any(List.class))) .thenReturn(ovsdbConnectionAugmentationBuilder); when(ovsdbConnectionAugmentationBuilder.build()).thenReturn(mock(OvsdbNodeAugmentation.class)); when(connectionNode.addAugmentation(any(OvsdbNodeAugmentation.class))).thenReturn(connectionNode); when(ovsdbConnectionAugmentationBuilder.getManagedNodeEntry()) .thenReturn(Map.of(managedBridge.key(), managedBridge)); Node node = mock(Node.class); when(connectionNode.build()).thenReturn(node); Bridge bridge = mock(Bridge.class); assertEquals(node, Whitebox.invokeMethod(ovsdbBridgeUpdateCommand, "buildConnectionNode", bridge)); }