Annotation Interface BeforeTestClass


@Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) @Documented @EventListener(BeforeTestClassEvent.class) public @interface BeforeTestClass
@EventListener annotation used to consume a BeforeTestClassEvent published by the EventPublishingTestExecutionListener.

This annotation may be used on @EventListener-compliant methods within a Infra test ApplicationContext — for example, on methods in a @Configuration class. A method annotated with this annotation will be invoked as part of the TestExecutionListener.beforeTestClass(cn.taketoday.test.context.TestContext) lifecycle.

Event processing can optionally be made conditional via a SpEL expression — for example, @BeforeTestClass("event.testContext.testClass.name matches '.+IntegrationTests'").

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.

从以下版本开始:
4.0
作者:
Frank Scheffler, Sam Brannen
另请参阅:
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    Alias for EventListener.condition().
  • 元素详细资料

    • value

      @AliasFor(annotation=cn.taketoday.context.event.EventListener.class, attribute="condition") String value
      Alias for EventListener.condition().
      默认值:
      ""