Skip to content

Commit

Permalink
feat(test): nicer formatting for check failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nergal-perm committed Sep 14, 2024
1 parent 6fb197e commit a701555
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/ru/ewc/checklogic/testing/CheckFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ private static String checkFailureAsHtml(final List<CheckFailure> failures) {
}

private static String formattedDescriptionFor(final CheckFailure failure) {
return "<li>Expected: <kbd>%s</kbd>, but got: <kbd>%s</kbd></li>"
.formatted(failure.expectation(), failure.actual());
return "<li>Expected: <kbd>%s</kbd>, but got: <kbd>%s</kbd></li>".formatted(
CheckFile.clearConstants(failure.expectation()),
CheckFile.clearConstants(failure.actual().split("=")[0])
);
}

private static String clearConstants(final String expectation) {
return expectation.replaceAll("constant::", "");
}
}

0 comments on commit a701555

Please sign in to comment.