Annotation Interface AftertestMethod
@Retention(RUNTIME)
@Target({METHOD,ANNOTATION_TYPE})
@Documented
@EventListener(AftertestMethodEvent.class)
public @interface AftertestMethod
@EventListener annotation used to consume an
AftertestMethodEvent published by the
EventPublishingtestExecutionListener.
This annotation may be used on @EventListener-compliant methods within
a Spring test ApplicationContext
— for example, on methods in a
@Configuration
class. A method annotated with this annotation will be invoked as part of the
testExecutionListener.aftertestMethod(testContext)
lifecycle.
Event processing can optionally be made conditional via
a SpEL expression — for example,
@AftertestMethod("event.testContext.testMethod.name matches 'test.*'").
The EventPublishingtestExecutionListener must be registered in order
for this annotation to have an effect — for example, via
@testExecutionListeners.
Note, however, that the EventPublishingtestExecutionListener is registered
by default.
- Since:
- 5.2
- Author:
- Frank Scheffler, Sam Brannen
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
Alias forEventListener.condition().- Default:
""
-