### Question:
ObjectMapperHelper { public static Optional<SnykTestStatus> unmarshall(Path path) throws IOException { if (path == null) { return Optional.empty(); } try (JsonParser parser = JSON_FACTORY.createParser(path.toFile())) { JsonToken token = parser.nextToken(); if (token == JsonToken.START_ARRAY) { List<SnykTestStatus> testStatuses = new ArrayList<>(); while (parser.nextToken() != JsonToken.END_ARRAY) { testStatuses.add(readTestResult(parser)); } return Optional.of(aggregateTestResults(testStatuses)); } else if (token == JsonToken.START_OBJECT) { return Optional.of(readTestResult(parser)); } else { return Optional.empty(); } } } private  ObjectMapperHelper(); static Optional<SnykTestStatus> unmarshall(Path path);  }### Answer:
@Test @DisplayName("unmarshall single report with vuln definitions") void unmarshall_singleProject_withVulns() throws Exception { Path snykReportJsonForSingleProject = Paths.get(TEST_FIXTURES_DIRECTORY.getAbsolutePath(), "single-module-project", "snyk_report_with_vulns.json"); Optional<SnykTestStatus> snykTestStatus = ObjectMapperHelper.unmarshall(snykReportJsonForSingleProject); assertTrue(snykTestStatus.isPresent()); assertAll("single-module-project-with-vulns", () -> assertFalse(snykTestStatus.get().ok), () -> assertEquals(10, snykTestStatus.get().dependencyCount), () -> assertEquals(3, snykTestStatus.get().uniqueCount) ); }
@Test @DisplayName("unmarshall single report without vuln definitions") void unmarshall_singleProject_withoutVulns() throws Exception { Path snykReportJsonForSingleProject = Paths.get(TEST_FIXTURES_DIRECTORY.getAbsolutePath(), "single-module-project", "snyk_report_without_vulns.json"); Optional<SnykTestStatus> snykTestStatus = ObjectMapperHelper.unmarshall(snykReportJsonForSingleProject); assertTrue(snykTestStatus.isPresent()); assertAll("single-module-project-without-vulns", () -> assertTrue(snykTestStatus.get().ok), () -> assertEquals(33, snykTestStatus.get().dependencyCount), () -> assertEquals(0, snykTestStatus.get().uniqueCount) ); }
@Test @DisplayName("unmarshall multi report with vuln definitions") void unmarshall_multiProject_withVulns() throws Exception { Path snykReportJsonForMultiProject = Paths.get(TEST_FIXTURES_DIRECTORY.getAbsolutePath(), "multi-module-project", "snyk_report_with_vulns.json"); Optional<SnykTestStatus> snykTestStatus = ObjectMapperHelper.unmarshall(snykReportJsonForMultiProject); assertTrue(snykTestStatus.isPresent()); assertAll("multi-module-project-with-vulns", () -> assertFalse(snykTestStatus.get().ok), () -> assertEquals(6, snykTestStatus.get().dependencyCount), () -> assertEquals(1, snykTestStatus.get().uniqueCount) ); }
@Test @DisplayName("unmarshall multi report without vuln definitions") void unmarshall_multiProject_withoutVulns() throws Exception { Path snykReportJsonForMultiProject = Paths.get(TEST_FIXTURES_DIRECTORY.getAbsolutePath(), "multi-module-project", "snyk_report_without_vulns.json"); Optional<SnykTestStatus> snykTestStatus = ObjectMapperHelper.unmarshall(snykReportJsonForMultiProject); assertTrue(snykTestStatus.isPresent()); assertAll("multi-module-project-without-vulns", () -> assertTrue(snykTestStatus.get().ok), () -> assertEquals(20, snykTestStatus.get().dependencyCount), () -> assertEquals(0, snykTestStatus.get().uniqueCount) ); }