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 TestContext
getSource()
Get theTestContext
associated with this event.TestContext
getTestContext()
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
- theTestContext
associated with this event (must not benull
)
Method Detail
getSource
public final TestContext getSource()
Get theTestContext
associated with this event.- Overrides:
getSource
in classEventObject
- Returns:
- the
TestContext
associated 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
TestContext
associated with this event (nevernull
) - See Also:
getSource()