Description
Follow-up on #4320.
In addition to the existing @BeforeAll
, @BeforeEach
, @AfterEach
, and @AfterAll
lifecycle methods, we should add introduce @BeforeArgumentSet
/@AfterArgumentSet
annotations that can be declared on static
(unless TestInstance.Lifecycle.PER_CLASS
is used) methods of the test class that will be executed once per argument set before/after all test methods and nested classes in a @ParameterizedContainer
class.
Since those methods are usually static
, they won't have access to the resolved parameters. Therefore, and for compatibility with JUnit 4's @BeforeParams
/@AfterParams
methods, we should support injecting them as method parameters of those lifecycle methods.
Deliverables
- Introduce
@BeforeArgumentSet
/@AfterArgumentSet
lifecycle methods for@ParameterizedContainer
classes - Add support for passing the resolved arguments of the current invocation to those lifecycle methods