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

    InstanceIdentifier<Link> instanceId = InstanceIdentifier.create(Link.class);
    Link hostLink = new LinkBuilder().setLinkId(new LinkId("openflow:1")).build();
    DataTreeModification<Link> mockChange = Mockito.mock(DataTreeModification.class);
    DataObjectModification<Link> mockModification = Mockito.mock(DataObjectModification.class);
    when(mockModification.getDataBefore()).thenReturn(hostLink);
    when(mockModification.getModificationType()).thenReturn(DataObjectModification.ModificationType.DELETE);
    when(mockChange.getRootPath()).thenReturn(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
            instanceId));
    when(mockChange.getRootNode()).thenReturn(mockModification);
    topologyLinkDataChangeHandler.onDataTreeChanged(Collections.singletonList(mockChange));
    Thread.sleep(500);
    verify(networkGraphService, times(1)).clear();
}