ClusterStateBundle { public boolean similarTo(ClusterStateBundle other) { if (!baselineState.getClusterState().similarToIgnoringInitProgress(other.baselineState.getClusterState())) { return false; } return derivedBucketSpaceStates.entrySet().stream() .allMatch(entry -> other.derivedBucketSpaceStates.getOrDefault(entry.getKey(), entry.getValue()) .getClusterState().similarToIgnoringInitProgress(entry.getValue().getClusterState())); } private  ClusterStateBundle(AnnotatedClusterState baselineState, Map<String, AnnotatedClusterState> derivedBucketSpaceStates); private  ClusterStateBundle(AnnotatedClusterState baselineState, Map<String,
                               AnnotatedClusterState> derivedBucketSpaceStates,
                               boolean deferredActivation); static Builder builder(AnnotatedClusterState baselineState); static ClusterStateBundle of(AnnotatedClusterState baselineState, Map<String, AnnotatedClusterState> derivedBucketSpaceStates); static ClusterStateBundle of(AnnotatedClusterState baselineState,
                                        Map<String, AnnotatedClusterState> derivedBucketSpaceStates,
                                        boolean deferredActivation); static ClusterStateBundle ofBaselineOnly(AnnotatedClusterState baselineState, boolean deferredActivation); static ClusterStateBundle ofBaselineOnly(AnnotatedClusterState baselineState); static ClusterStateBundle empty(); AnnotatedClusterState getBaselineAnnotatedState(); ClusterState getBaselineClusterState(); Map<String, AnnotatedClusterState> getDerivedBucketSpaceStates(); boolean deferredActivation(); ClusterStateBundle cloneWithMapper(Function<ClusterState, ClusterState> mapper); ClusterStateBundle clonedWithVersionSet(int version); boolean similarTo(ClusterStateBundle other); int getVersion(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void same_bundle_instance_considered_similar() { ClusterStateBundle bundle = createTestBundle(); assertTrue(bundle.similarTo(bundle)); }
@Test public void similarity_test_considers_all_bucket_spaces() { ClusterStateBundle bundle = createTestBundle(false); ClusterStateBundle unchangedBundle = createTestBundle(false); assertTrue(bundle.similarTo(unchangedBundle)); assertTrue(unchangedBundle.similarTo(bundle)); ClusterStateBundle changedBundle = createTestBundle(true); assertFalse(bundle.similarTo(changedBundle)); assertFalse(changedBundle.similarTo(bundle)); }