DefaultDcMetaChangeManager extends AbstractStartStoppable implements DcMetaChangeManager, MetaComparatorVisitor<ClusterMeta> { @Override public void visitRemoved(ClusterMeta removed) { ClusterMetaVisitor clusterMetaVisitor = new ClusterMetaVisitor(new ShardMetaVisitor(new RedisMetaVisitor(removeConsumer))); clusterMetaVisitor.accept(removed); } DefaultDcMetaChangeManager(HealthCheckInstanceManager instanceManager); @Override void compare(DcMeta future); @Override void visitAdded(ClusterMeta added); @Override void visitModified(MetaComparator comparator); @Override void visitRemoved(ClusterMeta removed);  }
@Test public void visitRemoved() { manager = spy(manager); manager.compare(getDcMeta("oy")); verify(manager, never()).visitModified(any()); verify(manager, never()).visitAdded(any()); verify(manager, never()).visitRemoved(any()); DcMeta dcMeta = MetaClone.clone(getDcMeta("oy")); ClusterMeta clusterMeta = dcMeta.getClusters().remove("cluster1"); clusterMeta.setId("cluster5").getShards().values().forEach(shardMeta -> { shardMeta.setParent(clusterMeta); for (RedisMeta redis : shardMeta.getRedises()) { redis.setParent(shardMeta); } }); dcMeta.addCluster(clusterMeta); manager.compare(dcMeta); verify(manager, atLeastOnce()).visitRemoved(any()); verify(manager, atLeastOnce()).visitAdded(any()); verify(manager, never()).visitModified(any()); }