Skip to content

How do I pass test generated values to AfterEachCallback #3613

Discussion options

You must be logged in to vote

You can use a ParameterResolver to inject an object into the test method that can create the object you need to clean up or register it. The extension implementing ParameterResolver and AfterEachCallback can then use the ExtensionContext.Store to store and retrieve it. If cleanup is all you need, you might not even need to implement AfterEachCallback but can wrap your object in CloseableResource before putting it into ExtensionContext.Store which will cause it to be cleaned up automatically.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@marcphilipp
Comment options

@pratyushdeshpande
Comment options

@pratyushdeshpande
Comment options

@marcphilipp
Comment options

@pratyushdeshpande
Comment options

Answer selected by pratyushdeshpande
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