Added new test for logException.
@@ -58,4 +58,17 @@ class FilteredLogTest {
" ... skipped logging of 2 additional errors ...");
assertThat(filteredLog.size()).isEqualTo(7);
}
+
+ @Test
+ void shouldLogExceptions() {
+ Report report = new Report();
+ FilteredLog filteredLog = new FilteredLog(report, TITLE, 1);
+
+ filteredLog.logException(new IllegalArgumentException("Cause"), "Message");
+ filteredLog.logException(new IllegalArgumentException(""), "Message");
+
+ assertThat(report.getErrorMessages()).contains(TITLE,
+ "Message", "java.lang.IllegalArgumentException: Cause",
+ "\tat edu.hm.hafner.analysis.FilteredLogTest.shouldLogExceptions(FilteredLogTest.java:67)");
+ }
}
\ No newline at end of file
