@Test public void testAggregateDuplicateErrorsDifferentLines() { ErrorDetails error = new ErrorDetails("message1", new ParseExceptionContext("line", 1234, "ctx")); ErrorDetails errorDupDifferentLine = new ErrorDetails("message1", new ParseExceptionContext("line", 5678, "ctx")); ErrorDetails errorUnique = new ErrorDetails("message1", new ParseExceptionContext("line2", 90, "ctx")); ImmutableMap<String, ErrorDetails> errors = ImmutableMap.of("dup1", error, "dup2", errorDupDifferentLine, "unique", errorUnique); assertThat( aggregateDuplicateErrors(errors), equalTo( ImmutableMap.of( new ErrorDetailsTriplet(error), ImmutableSortedSet.of("dup1", "dup2"), new ErrorDetailsTriplet(errorUnique), ImmutableSortedSet.of("unique")))); }
@Nonnull @VisibleForTesting static Map<ErrorDetailsTriplet, SortedSet<String>> aggregateDuplicateErrors( Map<String, ErrorDetails> nodeToErrorDetails) { Map<ErrorDetailsTriplet, SortedSet<String>> map = new HashMap<>(); nodeToErrorDetails.forEach( (source, details) -> map.computeIfAbsent(new ErrorDetailsTriplet(details), t -> new TreeSet<>()) .add(source)); return map; }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ErrorDetailsTriplet, SortedSet<String>> aggregateDuplicateErrors( Map<String, ErrorDetails> nodeToErrorDetails) { Map<ErrorDetailsTriplet, SortedSet<String>> map = new HashMap<>(); nodeToErrorDetails.forEach( (source, details) -> map.computeIfAbsent(new ErrorDetailsTriplet(details), t -> new TreeSet<>()) .add(source)); return map; } }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ErrorDetailsTriplet, SortedSet<String>> aggregateDuplicateErrors( Map<String, ErrorDetails> nodeToErrorDetails) { Map<ErrorDetailsTriplet, SortedSet<String>> map = new HashMap<>(); nodeToErrorDetails.forEach( (source, details) -> map.computeIfAbsent(new ErrorDetailsTriplet(details), t -> new TreeSet<>()) .add(source)); return map; }  }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ErrorDetailsTriplet, SortedSet<String>> aggregateDuplicateErrors( Map<String, ErrorDetails> nodeToErrorDetails) { Map<ErrorDetailsTriplet, SortedSet<String>> map = new HashMap<>(); nodeToErrorDetails.forEach( (source, details) -> map.computeIfAbsent(new ErrorDetailsTriplet(details), t -> new TreeSet<>()) .add(source)); return map; }   }
IssueAggregation { @Nonnull @VisibleForTesting static Map<ErrorDetailsTriplet, SortedSet<String>> aggregateDuplicateErrors( Map<String, ErrorDetails> nodeToErrorDetails) { Map<ErrorDetailsTriplet, SortedSet<String>> map = new HashMap<>(); nodeToErrorDetails.forEach( (source, details) -> map.computeIfAbsent(new ErrorDetailsTriplet(details), t -> new TreeSet<>()) .add(source)); return map; }    }