### Question:
OvsdbNodeListener extends DataTreeChangeHandler<Node> { @Override protected void onSubtreeModified(DataObjectModification<Node> rootNode, InstanceIdentifier<Node> rootIdentifier) { Node node = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (ovsdbBridge != null) { LOG.trace("OVSDB bridge updated: {} \n before {} \n after {}", rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); Set<DataObjectModification<OvsdbTerminationPointAugmentation>> ovsdbTpModifications = getOvsdbTpModifications(rootNode); NodeId ofNodeId = buildOfNodeId(ovsdbBridge); if (!ovsdbTpModifications.isEmpty() && ofNodeId != null) { NeutronBridgeWithExtPort bridge = getBridge(rootIdentifier); if (bridge.ofNodeId != null && !bridge.ofNodeId.equals(ofNodeId)) { LOG.debug("OVSDB bridge {} has changed datapath-id. \n Old: {} \n New: {}", node.getNodeId().getValue(), bridge.ofNodeId.getValue(), ofNodeId.getValue()); bridge.ofNodeId = ofNodeId; } } for (DataObjectModification<OvsdbTerminationPointAugmentation> ovsdbTpModification : ovsdbTpModifications) { OvsdbTerminationPointAugmentation newOvsdbTp = ovsdbTpModification.getDataAfter(); if (newOvsdbTp == null) { LOG.trace("Termination Point is null. Not processing"); continue; } if (ovsdbBridge.getBridgeName().getValue().equals(newOvsdbTp.getName())) { LOG.trace("Termination Point {} same as Bridge {}. Not processing", newOvsdbTp.getName(), ovsdbBridge.getBridgeName().getValue()); continue; } String portName = newOvsdbTp.getName(); Long ofport = newOvsdbTp.getOfport(); if (isOfportOrNameChanged(ovsdbTpModification) && portName != null && ofport != null) { NeutronBridgeWithExtPort bridge = getBridge(rootIdentifier); bridge.ofportByName.put(ofport, portName); LOG.trace("OVSDB termination point with ofport {} and port-name {} created.", ofport, portName); if (portName.equals(providerPortNameByBridgeRef.get(new OvsdbBridgeRef(rootIdentifier)))) { NodeConnectorId ofNcId = buildOfNodeConnectorId(newOvsdbTp, ofNodeId); bridge.externalIfaces.add(ofNcId); InventoryHelper.addOfOverlayExternalPort(bridge.ofNodeId, ofNcId, dataProvider); LOG.debug("Added of-overlay external-interface {} to node {}", ofNcId.getValue(), bridge.ofNodeId); traceBridge(rootIdentifier); } } } } } OvsdbNodeListener(DataBroker dataProvider, IntegrationBridgeSetting brSettings);   }### Answer:
@Test public void testOnSubtreeModified() { listener.onWrite(rootNode, rootIdentifier); when(rootNode.getModificationType()).thenReturn(DataObjectModification.ModificationType.SUBTREE_MODIFIED); listener.onDataTreeChanged(changes); }