@RetentionSE(valueSE=RUNTIMESE) @TargetSE(valueSE={METHODSE,ANNOTATION_TYPESE}) @DocumentedSE @EventListener(value=AfterTestMethodEvent.class) public @interface AfterTestMethod
EventPublishingTestExecutionListener
によって公開された AfterTestMethodEvent
を使用するために使用される @EventListener
アノテーション。 このアノテーションは、Spring Test ApplicationContext
内の @EventListener
-compliant メソッドで使用できます。たとえば、@Configuration
クラスのメソッドです。このアノテーションが付けられたメソッドは、TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)
ライフサイクルの一部として呼び出されます。
イベント処理は、オプションで SpEL 式(@AfterTestMethod("event.testContext.testMethod.name matches 'test.*'")
など)を使用して条件付きにすることができます。
このアノテーションを有効にするには、EventPublishingTestExecutionListener
を登録する必要があります。たとえば、@TestExecutionListeners
を使用します。
AfterTestMethodEvent
修飾子と型 | オプションの要素と説明 |
---|---|
StringSE | value EventListener.condition() のエイリアス。 |
@AliasFor(annotation=EventListener.class, attribute="condition") public abstract StringSE value
EventListener.condition()
のエイリアス。