-
-
Notifications
You must be signed in to change notification settings - Fork 765
Closed
Description
My use case is the following: I have a folder with some files and would like to generate a unit test for every file. Since JUnit is not supporting anything like that I was thinking of using the SoftAssertions class instead. Unfortunately the test function itself is not under my control and uses JUnit assertions resulting in AssertionErrors.
I would like to catch those AssertionErrors and throw them again inside the SoftAssertions instance. I got two ideas for how this could work:
try {
doTest(something);
} catch (AssertionError e) {
softAssertions.rethrow(e);
}of even simpler:
softAssertions.rethrow(() -> {
doTest(something);
});the only thing possible as of today looks like this:
try {
doTest(something);
} catch (Throwable e) {
softAssertions.assertThat(e).isNull();
}but this is not printing the stacktrace or any other details of the caught exceptions.
Metadata
Metadata
Assignees
Labels
No labels