@SuppressWarnings("unchecked")
@Test
public void onDataTreeChangedTest() {

    InstanceIdentifier<Node> instanceIdentifierMock = mock(InstanceIdentifier.class);
    DataTreeModification<Node> mockDataTreeModification = mock(DataTreeModification.class);
    DataObjectModification<Node> mockModification = mock(DataObjectModification.class);
    doReturn(mockModification).when(mockDataTreeModification).getRootNode();
    doReturn(DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, instanceIdentifierMock))
            .when(mockDataTreeModification).getRootPath();
    doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType();
    Node dataObjectNodeMock = mock(Node.class);
    doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).key();
    NodeId nodeIdMock = mock(NodeId.class);
    doReturn(nodeIdMock).when(dataObjectNodeMock).getNodeId();
    doReturn("nodeIdPattern1").when(nodeIdMock).getValue();
    doReturn(dataObjectNodeMock).when(mockModification).getDataAfter();
    eventSourceTopic.onDataTreeChanged(Collections.singletonList(mockDataTreeModification));
    verify(dataObjectNodeMock).getNodeId();
    verify(nodeIdMock).getValue();
}