@Test public void testAggregateParseStatuses() { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = aggregateParseStatuses( ImmutableSortedMap.of( "empty1", ParseStatus.EMPTY, "empty2", ParseStatus.EMPTY, "unknown", ParseStatus.UNKNOWN)); assertThat(aggregatedStatuses, aMapWithSize(2)); assertThat( aggregatedStatuses, IsMapContaining.hasEntry(equalTo(ParseStatus.EMPTY), contains("empty1", "empty2"))); assertThat( aggregatedStatuses, IsMapContaining.hasEntry(equalTo(ParseStatus.UNKNOWN), contains("unknown"))); }
@VisibleForTesting static SortedMap<ParseStatus, Set<String>> aggregateParseStatuses( SortedMap<String, ParseStatus> fileStatuses) { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = new TreeMap<>(); for (Entry<String, ParseStatus> entry : fileStatuses.entrySet()) { Set<String> files = aggregatedStatuses.computeIfAbsent(entry.getValue(), s -> new HashSet<>()); files.add(entry.getKey()); } return aggregatedStatuses; }
InitIssuesAnswerer extends Answerer { @VisibleForTesting static SortedMap<ParseStatus, Set<String>> aggregateParseStatuses( SortedMap<String, ParseStatus> fileStatuses) { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = new TreeMap<>(); for (Entry<String, ParseStatus> entry : fileStatuses.entrySet()) { Set<String> files = aggregatedStatuses.computeIfAbsent(entry.getValue(), s -> new HashSet<>()); files.add(entry.getKey()); } return aggregatedStatuses; } }
InitIssuesAnswerer extends Answerer { @VisibleForTesting static SortedMap<ParseStatus, Set<String>> aggregateParseStatuses( SortedMap<String, ParseStatus> fileStatuses) { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = new TreeMap<>(); for (Entry<String, ParseStatus> entry : fileStatuses.entrySet()) { Set<String> files = aggregatedStatuses.computeIfAbsent(entry.getValue(), s -> new HashSet<>()); files.add(entry.getKey()); } return aggregatedStatuses; } InitIssuesAnswerer(InitIssuesQuestion question, IBatfish batfish); }
InitIssuesAnswerer extends Answerer { @VisibleForTesting static SortedMap<ParseStatus, Set<String>> aggregateParseStatuses( SortedMap<String, ParseStatus> fileStatuses) { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = new TreeMap<>(); for (Entry<String, ParseStatus> entry : fileStatuses.entrySet()) { Set<String> files = aggregatedStatuses.computeIfAbsent(entry.getValue(), s -> new HashSet<>()); files.add(entry.getKey()); } return aggregatedStatuses; } InitIssuesAnswerer(InitIssuesQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot); }
InitIssuesAnswerer extends Answerer { @VisibleForTesting static SortedMap<ParseStatus, Set<String>> aggregateParseStatuses( SortedMap<String, ParseStatus> fileStatuses) { SortedMap<ParseStatus, Set<String>> aggregatedStatuses = new TreeMap<>(); for (Entry<String, ParseStatus> entry : fileStatuses.entrySet()) { Set<String> files = aggregatedStatuses.computeIfAbsent(entry.getValue(), s -> new HashSet<>()); files.add(entry.getKey()); } return aggregatedStatuses; } InitIssuesAnswerer(InitIssuesQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot);  }