ComparisonResult { public boolean ok(){ return missingTopics.isEmpty() && mismatchingReplicationFactor.isEmpty() && mismatchingPartitionCount.isEmpty() && mismatchingConfiguration.isEmpty(); } ComparisonResult(Set<String> missingTopics, Map<String, Comparison<Integer>> mismatchingReplicationFactor, Map<String, Comparison<Integer>> mismatchingPartitionCount, Map<String, Collection<Comparison<String>>> mismatchingConfiguration); boolean ok(); Set<String> getMissingTopics(); Map<String, Comparison<Integer>> getMismatchingReplicationFactor(); Map<String, Comparison<Integer>> getMismatchingPartitionCount(); Map<String, Collection<Comparison<String>>> getMismatchingConfiguration(); @Override String toString();  }
@Test @DisplayName("When there are no errors set, the result is ok") public void ok(){ ComparisonResult comparisonResult = new ComparisonResult.ComparisonResultBuilder().build(); assertTrue(comparisonResult.ok()); }
@Test @DisplayName("When there are is a missing topic, the result is not ok") public void missing_topic(){ ComparisonResult comparisonResult = new ComparisonResult.ComparisonResultBuilder().addMissingTopic("hurz").build(); assertFalse(comparisonResult.ok()); }
@Test @DisplayName("When there are is a wrong replication factor, the result is not ok") public void wrong_rf(){ ComparisonResult comparisonResult = new ComparisonResult.ComparisonResultBuilder().addMismatchingReplicationFactor("hurz", 1, 2).build(); assertFalse(comparisonResult.ok()); }
@Test @DisplayName("When there are is a wrong partition count, the result is not ok") public void wrong_broker_count(){ ComparisonResult comparisonResult = new ComparisonResult.ComparisonResultBuilder().addMismatchingPartitionCount("hurz", 1, 2).build(); assertFalse(comparisonResult.ok()); }
@Test @DisplayName("When there are is a wrong configuration, the result is not ok") public void wrong_config(){ ComparisonResult comparisonResult = new ComparisonResult.ComparisonResultBuilder().addMismatchingConfiguration("hurz", "burz", "2", "3").build(); assertFalse(comparisonResult.ok()); }