@Test
public void shouldWriteComparisonReportAsJson() throws Exception {
ScreenshotComparisonResult screenshotComparisonResult =
new ScreenshotComparisonResult("url", 1337, 1338, 0d, "before", "after", "differenceImageFileName", 0);
final Summary localSummary = new Summary(false, 0d, 0d);
final Summary globalSummary = new Summary(false, 0d, 0d);
Report report = new Report(globalSummary, singletonMap("test", new UrlReport(singletonList(screenshotComparisonResult), localSummary)), JobConfig.exampleConfig());
String expectedString = "[\n" +
" {\n" +
" \"url\": \"url\",\n" +
" \"width\": 1337,\n" +
" \"verticalScrollPosition\": 1338,\n" +
" \"difference\": 0.0,\n" +
" \"screenshotBeforeFileName\": \"before\",\n" +
" \"screenshotAfterFileName\": \"after\",\n" +
" \"differenceImageFileName\": \"differenceImageFileName\",\n" +
" \"maxSingleColorDifference\": 0\n" +
" }\n" +
"]";
testee.writeComparisonReportAsJson(report);
Mockito.verify(fileServiceMock).writeJsonReport(expectedString);
}
}