de.otto.jlineup.report.ReportGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jlineup Show documentation
Show all versions of jlineup Show documentation
Webapp image comparison tool
package de.otto.jlineup.report;
import java.util.*;
public class ReportGenerator {
public Report generateReport(List screenshotComparisonResultList) {
final double differenceSum = screenshotComparisonResultList.stream().mapToDouble(scr -> scr.difference).sum();
final OptionalDouble differenceMax = screenshotComparisonResultList.stream().mapToDouble(scr -> scr.difference).max();
final Summary summary = new Summary(differenceSum > 0, differenceSum, differenceMax.orElseGet(() -> 0));
Map> resultsPerUrl = new HashMap<>();
for (ScreenshotComparisonResult screenshotComparisonResult : screenshotComparisonResultList) {
List resultListForUrl = resultsPerUrl.getOrDefault(screenshotComparisonResult.url, new ArrayList<>());
resultListForUrl.add(screenshotComparisonResult);
resultsPerUrl.putIfAbsent(screenshotComparisonResult.url, resultListForUrl);
}
return new Report(summary, resultsPerUrl);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy