@Test
public void testReportsToJson() throws Exception {

    final List<CheckReport> originalReports = asList(
            new SimpleReport("test/first",
                    singletonList(
                            new SimpleViolation(Severity.MINOR,
                                    "one",
                                    PackageId.fromString("test:first")))
            ),
            new SimpleReport("test/second",
                    asList(
                            new SimpleViolation(Severity.MINOR,
                                    "one", PackageId.fromString("test:first")),
                            new SimpleViolation(Severity.MINOR,
                                    "two",
                                    PackageId.fromString("test:first"),
                                    PackageId.fromString("test:second"))
                    )
            )
    );
    final StringWriter writer = new StringWriter();
    ReportMapper.writeReports(originalReports, () -> writer);
    assertEquals("CheckReports should round trip",
            new ArrayList<>(originalReports),
            new ArrayList<>(ReportMapper.readReports(() -> new StringReader(writer.toString()))));
}