Source:
public void testResetSnapshots() { HelixClusterVerifier _clusterVerifier = new StrictMatchExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient) .setDeactivatedNodeAwareness(true) .setResources(new HashSet<>(_dataAccessor.getChildNames(_keyBuilder.idealStates()))) .setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME) .build(); try { boolean result = _clusterVerifier.verify(); Assert.assertTrue(result); } finally{ _clusterVerifier.close(); } ResourceChangeDetector changeDetector = new ResourceChangeDetector(); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 1); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 0); changeDetector.resetSnapshots(); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 1); }

Target:
public void testResetSnapshots() { HelixClusterVerifier _clusterVerifier = new StrictMatchExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient) .setDeactivatedNodeAwareness(true) .setResources(new HashSet<>(_dataAccessor.getChildNames(_keyBuilder.idealStates()))) .setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME) .build(); try { Assert.assertTrue(_clusterVerifier.verify()); } finally{ _clusterVerifier.close(); } ResourceChangeDetector changeDetector = new ResourceChangeDetector(); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 1); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 0); changeDetector.resetSnapshots(); _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE); _dataProvider.refresh(_dataAccessor); changeDetector.updateSnapshots(_dataProvider); Assert.assertEquals( changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + changeDetector .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 1); }