### Question:
WagedRebalancer implements StatefulRebalancer<ResourceControllerDataProvider> { @Override public void reset() { if (_assignmentMetadataStore != null) { _assignmentMetadataStore.reset(); } _changeDetector.resetSnapshots(); } WagedRebalancer(HelixManager helixManager); protected  WagedRebalancer(AssignmentMetadataStore assignmentMetadataStore,
      RebalanceAlgorithm algorithm, Optional<MetricCollector> metricCollectorOptional); private  WagedRebalancer(AssignmentMetadataStore assignmentMetadataStore,
      RebalanceAlgorithm algorithm, MappingCalculator mappingCalculator, HelixManager manager,
      MetricCollector metricCollector, boolean isAsyncGlobalRebalanceEnabled); void setGlobalRebalanceAsyncMode(boolean isAsyncGlobalRebalanceEnabled); synchronized void updateRebalancePreference(
      Map<ClusterConfig.GlobalRebalancePreferenceKey, Integer> newPreference); @Override void reset(); @Override void close(); @Override Map<String, IdealState> computeNewIdealStates(ResourceControllerDataProvider clusterData,
      Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput);  }### Answer:
@Test(dependsOnMethods = "testRebalance") public void testReset() throws IOException, HelixRebalanceException { _metadataStore.reset(); WagedRebalancer rebalancer = new WagedRebalancer(_metadataStore, _algorithm, Optional.empty()); ResourceControllerDataProvider clusterData = setupClusterDataCache(); Map<String, Resource> resourceMap = clusterData.getIdealStates().entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey(), entry -> { Resource resource = new Resource(entry.getKey()); entry.getValue().getPartitionSet().stream() .forEach(partition -> resource.addPartition(partition)); return resource; })); when(clusterData.getRefreshedChangeTypes()) .thenReturn(Collections.singleton(HelixConstants.ChangeType.CLUSTER_CONFIG)); Map<String, IdealState> newIdealStates = rebalancer.computeNewIdealStates(clusterData, resourceMap, new CurrentStateOutput()); Map<String, ResourceAssignment> algorithmResult = _algorithm.getRebalanceResult(); validateRebalanceResult(resourceMap, newIdealStates, algorithmResult); algorithmResult.clear(); when(clusterData.getRefreshedChangeTypes()) .thenReturn(Collections.singleton(HelixConstants.ChangeType.CLUSTER_CONFIG)); Assert.assertEquals( rebalancer.computeNewIdealStates(clusterData, resourceMap, new CurrentStateOutput()), newIdealStates); algorithmResult = _algorithm.getRebalanceResult(); Assert.assertEquals(algorithmResult, Collections.emptyMap()); rebalancer.reset(); algorithmResult.clear(); when(clusterData.getRefreshedChangeTypes()) .thenReturn(Collections.singleton(HelixConstants.ChangeType.CLUSTER_CONFIG)); newIdealStates = rebalancer.computeNewIdealStates(clusterData, resourceMap, new CurrentStateOutput()); algorithmResult = _algorithm.getRebalanceResult(); validateRebalanceResult(resourceMap, newIdealStates, algorithmResult); }