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
Base class for events published by the
EventPublishingTestExecutionListener
.- Since:
- 5.2
- Author:
- Frank Scheffler, Sam Brannen
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal TestContext
Get theTestContext
associated with this event.final TestContext
Alias forgetSource()
.Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
toString
-
Constructor Details
-
TestContextEvent
Create a newTestContextEvent
.- Parameters:
source
- theTestContext
associated with this event (must not benull
)
-
-
Method Details
-
getSource
Get theTestContext
associated with this event.- Overrides:
getSource
in classEventObject
- Returns:
- the
TestContext
associated with this event (nevernull
) - See Also:
-
getTestContext
Alias forgetSource()
.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 (nevernull
) - See Also:
-