Class AbstractTestExecutionListener
- java.lang.Object
- org.springframework.test.context.support.AbstractTestExecutionListener
- All Implemented Interfaces:
Ordered
,TestExecutionListener
- Direct Known Subclasses:
AbstractDirtiesContextTestExecutionListener
,DependencyInjectionTestExecutionListener
,ServletTestExecutionListener
,SqlScriptsTestExecutionListener
,TransactionalTestExecutionListener
public abstract class AbstractTestExecutionListener extends Object implements TestExecutionListener, Ordered
Abstract implementation of theTestExecutionListener
interface which provides empty method stubs. Subclasses can extend this class and override only those methods suitable for the task at hand.- Since:
- 2.5
- Author:
- Sam Brannen, Juergen Hoeller
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description AbstractTestExecutionListener()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterTestClass(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
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 Detail
AbstractTestExecutionListener
public AbstractTestExecutionListener()
Method Detail
beforeTestClass
public void beforeTestClass(TestContext testContext) throws Exception
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
prepareTestInstance
public void prepareTestInstance(TestContext testContext) throws Exception
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
public void beforeTestMethod(TestContext testContext) throws Exception
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
afterTestMethod
public void afterTestMethod(TestContext testContext) throws Exception
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
afterTestClass
public void afterTestClass(TestContext testContext) throws Exception
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
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.- Specified by:
getOrder
in interfaceOrdered
- Returns:
- the order value
- Since:
- 4.1
- See Also:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE