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 theEventPublishingTestExecutionListener.- Since:
- 5.2
- Author:
- Frank Scheffler, Sam Brannen
- See Also:
- Serialized Form
Field Summary
Fields inherited from class java.util.EventObject
source
Constructor Summary
Constructors Constructor Description TestContextEvent(TestContext source)Create a newTestContextEvent.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestContextgetSource()Get theTestContextassociated with this event.TestContextgetTestContext()Alias forgetSource().Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
toString
Constructor Detail
TestContextEvent
public TestContextEvent(TestContext source)
Create a newTestContextEvent.- Parameters:
source- theTestContextassociated with this event (must not benull)
Method Detail
getSource
public final TestContext getSource()
Get theTestContextassociated with this event.- Overrides:
getSourcein classEventObject- Returns:
- the
TestContextassociated with this event (nevernull) - See Also:
getTestContext()
getTestContext
public final TestContext getTestContext()
Alias forgetSource().This method may be favored over
getSource()— for example, to improve readability in SpEL expressions for event processing conditions.- Returns:
- the
TestContextassociated with this event (nevernull) - See Also:
getSource()