Class AbstractTestExecutionListener
java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
- All Implemented Interfaces:
Ordered
,TestExecutionListener
- Direct Known Subclasses:
AbstractDirtiesContextTestExecutionListener
,ApplicationEventsTestExecutionListener
,DependencyInjectionTestExecutionListener
,EventPublishingTestExecutionListener
,ServletTestExecutionListener
,SqlScriptsTestExecutionListener
,TransactionalTestExecutionListener
public abstract class AbstractTestExecutionListener
extends Object
implements TestExecutionListener, Ordered
Abstract ordered implementation of the
TestExecutionListener
API.- Since:
- 2.5
- Author:
- Sam Brannen, Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterTestClass
(TestContext testContext) The default implementation is empty.void
afterTestExecution
(TestContext testContext) The default implementation is empty.void
afterTestMethod
(TestContext testContext) The default implementation is empty.void
beforeTestClass
(TestContext testContext) The default implementation is empty.void
beforeTestExecution
(TestContext testContext) The default implementation is empty.void
beforeTestMethod
(TestContext testContext) The default implementation is empty.int
getOrder()
The default implementation returnsOrdered.LOWEST_PRECEDENCE
, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework.void
prepareTestInstance
(TestContext testContext) The default implementation is empty.
-
Constructor Details
-
AbstractTestExecutionListener
public AbstractTestExecutionListener()
-
-
Method Details
-
getOrder
public int getOrder()The default implementation returnsOrdered.LOWEST_PRECEDENCE
, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework. Can be overridden by subclasses as necessary. -
beforeTestClass
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
beforeTestClass
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context for the test; nevernull
- Throws:
Exception
- allows any exception to propagate- Since:
- 3.0
-
prepareTestInstance
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
prepareTestInstance
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context for the test; nevernull
- Throws:
Exception
- allows any exception to propagate
-
beforeTestMethod
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
beforeTestMethod
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context in which the test method will be executed; nevernull
- Throws:
Exception
- allows any exception to propagate- See Also:
-
beforeTestExecution
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
beforeTestExecution
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context in which the test method will be executed; nevernull
- Throws:
Exception
- allows any exception to propagate- Since:
- 5.2
- See Also:
-
afterTestExecution
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
afterTestExecution
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context in which the test method will be executed; nevernull
- Throws:
Exception
- allows any exception to propagate- Since:
- 5.2
- See Also:
-
afterTestMethod
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
afterTestMethod
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context in which the test method was executed; nevernull
- Throws:
Exception
- allows any exception to propagate- See Also:
-
afterTestClass
The default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
afterTestClass
in interfaceTestExecutionListener
- Parameters:
testContext
- the test context for the test; nevernull
- Throws:
Exception
- allows any exception to propagate- Since:
- 3.0
-