注释类型 AfterTestMethod
@Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) @Documented @EventListener(AfterTestMethodEvent.class) public @interface AfterTestMethod
@EventListener
annotation used to consume aAfterTestMethodEvent
published by theEventPublishingTestExecutionListener
.This annotation may be used on
@EventListener
-compliant methods within a Spring testApplicationContext
— for example, on methods in a@Configuration
class. A method annotated with this annotation will be invoked as part of theTestExecutionListener.afterTestMethod(org.springframework.test.context.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
.- 从以下版本开始:
- 5.2
- 作者:
- Frank Scheffler, Sam Brannen
- 另请参阅:
AfterTestMethodEvent
可选元素概要
可选元素 修饰符和类型 可选元素 说明 String
value
Alias forEventListener.condition()
.
元素详细资料
value
@AliasFor(annotation=EventListener.class, attribute="condition") String value
Alias forEventListener.condition()
.- 默认值:
- ""