Skip to content

Commit

Permalink
Add error logging to failing unit test
Browse files Browse the repository at this point in the history
as a workaround for missing access to unit test detail log.
  • Loading branch information
rainerjung committed Apr 27, 2023
1 parent 996e8df commit e718646
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/org/apache/catalina/valves/TestAccessLogValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public void Test() {
valve.setPattern(logPattern);
tomcat.getHost().getPipeline().addValve(valve);
} else {
log.error("Unknown AccessLogValve type " + type);
Assert.fail("Unknown AccessLogValve type " + type);
}

Expand All @@ -180,6 +181,9 @@ public void Test() {
}
String result = writer.toString();
boolean matches = Pattern.matches(resultMatch, result);
if (!matches) {
log.error("Resulting log line '" + result + "' does not match '" + resultMatch + "'");
}
Assert.assertTrue("Resulting log line '" + result + "' does not match '" + resultMatch + "'", matches);

if (JSON_TYPE.equals(type)) {
Expand Down

0 comments on commit e718646

Please sign in to comment.