Class TestContextEvent

java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.test.context.event.TestContextEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AfterTestClassEvent, AfterTestExecutionEvent, AfterTestMethodEvent, BeforeTestClassEvent, BeforeTestExecutionEvent, BeforeTestMethodEvent, PrepareTestInstanceEvent

public abstract class TestContextEvent extends ApplicationEvent
Base class for events published by the EventPublishingTestExecutionListener.
Since:
5.2
Author:
Frank Scheffler, Sam Brannen
See Also:
  • Constructor Details

    • TestContextEvent

      public TestContextEvent(TestContext source)
      Create a new TestContextEvent.
      Parameters:
      source - the TestContext associated with this event (must not be null)
  • Method Details

    • getSource

      public final TestContext getSource()
      Get the TestContext associated with this event.
      Overrides:
      getSource in class EventObject
      Returns:
      the TestContext associated with this event (never null)
      See Also:
    • getTestContext

      public final TestContext getTestContext()
      Alias for getSource().

      This method may be favored over getSource() — for example, to improve readability in SpEL expressions for event processing conditions.

      Returns:
      the TestContext associated with this event (never null)
      See Also: