@SuppressWarnings("unchecked")
@Test
public void onDataChange_Valid() throws Exception {

    InstanceIdentifier<Node> instanceId = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, new NodeKey(new NodeId("openflow:1")))
            .build();
    Node topoNode = new NodeBuilder().setId(new NodeId("openflow:1")).build();
    DataTreeModification<Node> mockChange = Mockito.mock(DataTreeModification.class);
    DataObjectModification<Node> mockModification = Mockito.mock(DataObjectModification.class);
    when(mockModification.getDataAfter()).thenReturn(topoNode);
    when(mockModification.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE);
    when(mockChange.getRootPath()).thenReturn(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
            instanceId));
    when(mockChange.getRootNode()).thenReturn(mockModification);
    initialFlowWriter.onDataTreeChanged(Collections.singletonList(mockChange));
    Thread.sleep(250);
    verify(salFlowService, times(1)).addFlow(any(AddFlowInput.class));
}