Skip to content

Commit

Permalink
Added validation reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed May 2, 2022
1 parent 88f1d65 commit adfeabb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -70,9 +70,11 @@ public void output(ValidationResult result, Writer out) throws IOException {
}

private void outputHtml(ValidationResult result, Writer out) throws IOException {
out.write("<ol>");
for (ValidationEntry entry : result.getEntries()) {
out.write(String.format("<p>%s: %s - %s</p>\n", entry.getContext(), entry.getSeverity(), entry.getMessage()));
out.write(String.format("<li>%s: %s - %s</li>\n", entry.getContext(), entry.getSeverity(), entry.getMessage()));
}
out.write("</ol>");
}

private void outputText(ValidationResult result, Writer out) throws IOException {
Expand Down
Expand Up @@ -95,6 +95,6 @@ class ValidationReportTest extends Specification {
new ValidationReport(HTML).output(result, writer)

then: 'output matches expected'
writer as String == '<p>DTSTART: WARNING - Invalid parameter</p>\n<p>VCALENDAR: ERROR - Missing mandatory properties</p>\n'
writer as String == '<ol><li>DTSTART: WARNING - Invalid parameter</li>\n<li>VCALENDAR: ERROR - Missing mandatory properties</li>\n</ol>'
}
}

0 comments on commit adfeabb

Please sign in to comment.