HistoryPlugin implements Reader, Aggregator { protected Map<String, HistoryData> getData(final List<LaunchResults> launches) { final Map<String, HistoryData> history = launches.stream() .map(launch -> launch.getExtra(HISTORY_BLOCK_NAME, (Supplier<Map<String, HistoryData>>) HashMap::new)) .reduce(new HashMap<>(), (a, b) -> { a.putAll(b); return a; }); launches.forEach(launch -> { final ExecutorInfo executorInfo = launch.getExtra( ExecutorPlugin.EXECUTORS_BLOCK_NAME, ExecutorInfo::new ); launch.getResults().stream() .filter(result -> Objects.nonNull(result.getHistoryId())) .forEach(result -> updateHistory(history, result, executorInfo)); }); return history; }  @Override void readResults(final Configuration configuration,
                            final ResultsVisitor visitor,
                            final Path directory); @Override void aggregate(final Configuration configuration,
                          final List<LaunchResults> launchesResults,
                          final Path outputDirectory);  }
@Test void shouldReduceHistoryResults() { String historyId1 = UUID.randomUUID().toString(); String historyId2 = UUID.randomUUID().toString(); final Map<String, Object> extra1 = new HashMap<>(); final Map<String, Object> extra2 = new HashMap<>(); final Map<String, HistoryData> historyDataMap = new HashMap<>(); historyDataMap.put(historyId1, new HistoryData().setItems(singletonList(createHistoryItem(PASSED, 1, 2)))); historyDataMap.put(historyId2, new HistoryData().setItems(singletonList(createHistoryItem(PASSED, 2, 3)))); extra1.put(HISTORY_BLOCK_NAME, historyDataMap); extra2.put(HISTORY_BLOCK_NAME, copyHistoryData(historyDataMap)); Map<String, HistoryData> data = new HistoryPlugin().getData(asList( createLaunchResults(extra1, createTestResult(PASSED, historyId1, 3, 4)), createLaunchResults(extra2, createTestResult(PASSED, historyId2, 5, 6)) )); assertThat(data).containsKeys(historyId1, historyId2); assertThat(data.get(historyId1).getItems()).hasSize(2); assertThat(data.get(historyId2).getItems()).hasSize(2); }