Skip to content
Discussion options

You must be logged in to vote

The piece you're missing is TestExecutionExceptionHandler. It runs while the failure is still in flight, which is the only point where you can attach something that ends up inside the failure itself rather than beside it.

The contract is explicit about what you may do with the throwable:

Implementors must perform one of the following.
1. Swallow the supplied throwable, thereby preventing propagation.
2. Rethrow the supplied throwable as is.
3. Throw a new exception, potentially wrapping the supplied throwable.

Option 2 with a suppressed exception attached is what fits your goal, since the seed then travels with the failure rather than as separate output:

class RandomSeedExtension implements

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by toolforger
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@toolforger
Comment options

Comment options

You must be logged in to vote
1 reply
@vshulcz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants