Closed leonard84 closed 7 years ago
I think there are semantic differences between MultipleFailuresError
and Throwable.addSuppressed
. While the former signifies that multiple assertions failed, the latter means there was one failure and some other exceptions were suppressed during processing, e.g. tear-down.
Libraries that use opentest4j can already use Throwable.addSuppressed with e.g. AssertionFailedError
if they require at least Java 7. For instance, the JUnit Jupiter engine does exactly that.
What could opentest4j offer in addition?
I fully agree with @marcphilipp. Just adding, one of the uses cases where we utilized this was to collect errors emitted in vintage. These errors have all the same sematic importance. Using suppressed we would have a problem selecting which error is the main and which exceptions should be suppressed.
Ok, if the distinction of MultipleFailuresError
vs Throwable.addSuppressed
is that the former is used to collect multiple assertion errors and the latter is used to attach subsequent exceptions in listeners/cleanup handlers.
Sounds like we're in agreement so I'm closing this issue.
Currently opentest4j uses Java 6 compatibility, which prevents
Throwable.addSuppressed
. However, Java 6 has been EOL for a very long time so switching to Java 7/8 should be considered. Which raises the question ifMultipleFailuresError
is still needed when further exceptions could simply be added byThrowable.addSuppressed
.