@Test public void testAggregateDuplicateParseWarnings() { Warnings f1Warnings = new Warnings(); f1Warnings .getParseWarnings() .addAll( ImmutableList.of( new ParseWarning(3, "dup", "[configuration]", null), new ParseWarning(4, "dup", "[configuration]", null), new ParseWarning(5, "unique", "[configuration]", null))); Warnings f2Warnings = new Warnings(); f2Warnings .getParseWarnings() .addAll(ImmutableList.of(new ParseWarning(23, "dup", "[configuration]", null))); Map<String, Warnings> fileWarnings = ImmutableMap.of("f1", f1Warnings, "f2", f2Warnings); Map<ParseWarningTriplet, Multimap<String, Integer>> aggregatedWarnings = aggregateDuplicateParseWarnings(fileWarnings); ParseWarningTriplet expectedKey1 = new ParseWarningTriplet("dup", "[configuration]", null); ParseWarningTriplet expectedKey2 = new ParseWarningTriplet("unique", "[configuration]", null); assertThat(aggregatedWarnings.keySet(), contains(expectedKey1, expectedKey2)); assertThat(aggregatedWarnings.get(expectedKey1).values(), containsInAnyOrder(3, 4, 23)); assertThat(aggregatedWarnings.get(expectedKey2).values(), contains(5)); }
@Nonnull @VisibleForTesting static Map<ParseWarningTriplet, Multimap<String, Integer>> aggregateDuplicateParseWarnings( Map<String, Warnings> fileWarnings) { Map<ParseWarningTriplet, Multimap<String, Integer>> map = new HashMap<>(); fileWarnings.forEach( (filename, warnings) -> { for (ParseWarning w : warnings.getParseWarnings()) { ParseWarningTriplet triplet = new ParseWarningTriplet(w); map.computeIfAbsent(triplet, k -> HashMultimap.create()).put(filename, w.getLine()); } }); return map; }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ParseWarningTriplet, Multimap<String, Integer>> aggregateDuplicateParseWarnings( Map<String, Warnings> fileWarnings) { Map<ParseWarningTriplet, Multimap<String, Integer>> map = new HashMap<>(); fileWarnings.forEach( (filename, warnings) -> { for (ParseWarning w : warnings.getParseWarnings()) { ParseWarningTriplet triplet = new ParseWarningTriplet(w); map.computeIfAbsent(triplet, k -> HashMultimap.create()).put(filename, w.getLine()); } }); return map; } }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ParseWarningTriplet, Multimap<String, Integer>> aggregateDuplicateParseWarnings( Map<String, Warnings> fileWarnings) { Map<ParseWarningTriplet, Multimap<String, Integer>> map = new HashMap<>(); fileWarnings.forEach( (filename, warnings) -> { for (ParseWarning w : warnings.getParseWarnings()) { ParseWarningTriplet triplet = new ParseWarningTriplet(w); map.computeIfAbsent(triplet, k -> HashMultimap.create()).put(filename, w.getLine()); } }); return map; }  }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ParseWarningTriplet, Multimap<String, Integer>> aggregateDuplicateParseWarnings( Map<String, Warnings> fileWarnings) { Map<ParseWarningTriplet, Multimap<String, Integer>> map = new HashMap<>(); fileWarnings.forEach( (filename, warnings) -> { for (ParseWarning w : warnings.getParseWarnings()) { ParseWarningTriplet triplet = new ParseWarningTriplet(w); map.computeIfAbsent(triplet, k -> HashMultimap.create()).put(filename, w.getLine()); } }); return map; }   }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ParseWarningTriplet, Multimap<String, Integer>> aggregateDuplicateParseWarnings( Map<String, Warnings> fileWarnings) { Map<ParseWarningTriplet, Multimap<String, Integer>> map = new HashMap<>(); fileWarnings.forEach( (filename, warnings) -> { for (ParseWarning w : warnings.getParseWarnings()) { ParseWarningTriplet triplet = new ParseWarningTriplet(w); map.computeIfAbsent(triplet, k -> HashMultimap.create()).put(filename, w.getLine()); } }); return map; }    }