ValidationReportUtils { public static List<String> getValidationWarnings(final String jsonValidationResult) { try { return JsonPath.read(jsonValidationResult, "$.validationReport.validationConclusion.validationWarnings[*].content"); } catch (PathNotFoundException e) { LOGGER.trace("Validation warnings not present in JSON: ", e); return Collections.emptyList(); } }  static String getValidateFilename(final String reportJSON); static List<String> getValidationWarnings(final String jsonValidationResult); static String getOverallValidationResult(final String reportJSON); static String handleMissingJSON(); static boolean isJSONValid(String json);  }
@Test public void documentValidationWarningNotEmpty() throws Exception { List<String> expected = new ArrayList<>(); expected.add("Some validation warning"); final String json = "{\"validationReport\":{\"validationConclusion\":{\"validationWarnings\":[{\"content\":\"Some validation warning\"}]}}}"; assertEquals(expected, ValidationReportUtils.getValidationWarnings(json)); }
@Test public void documentValidationWarningEmpty() throws Exception { final String json = "{\"validationWarnings\":[]}"; assertEquals(Collections.emptyList(), ValidationReportUtils.getValidationWarnings(json)); }