com.github.springtestdbunit
Class TestExecutionListenerChain
java.lang.Object
com.github.springtestdbunit.TestExecutionListenerChain
- All Implemented Interfaces:
- org.springframework.test.context.TestExecutionListener
- Direct Known Subclasses:
- TransactionDbUnitTestExecutionListener
public abstract class TestExecutionListenerChain
- extends Object
- implements org.springframework.test.context.TestExecutionListener
A TestExecutionListener implementation that works by chaining together other TestExecutionListeners
and ensures that methods are called in the correct order. The prepareTestInstance(org.springframework.test.context.TestContext), beforeTestClass(org.springframework.test.context.TestContext)
and afterTestClass(org.springframework.test.context.TestContext) methods will delegate to the chain in the order that it is defined. The
afterTestClass(org.springframework.test.context.TestContext) and afterTestMethod(org.springframework.test.context.TestContext) methods will delegate in reverse order. methods.
For example, a typical call on a chain containing items "a" and "b" would be: a.beforeTestMethod,
b.beforeTestMethod, b.afterTestMethod, a.afterTestMethod.
- Author:
- Phillip Webb
|
Method Summary |
void |
afterTestClass(org.springframework.test.context.TestContext testContext)
|
void |
afterTestMethod(org.springframework.test.context.TestContext testContext)
|
void |
beforeTestClass(org.springframework.test.context.TestContext testContext)
|
void |
beforeTestMethod(org.springframework.test.context.TestContext testContext)
|
protected List<org.springframework.test.context.TestExecutionListener> |
createChain()
Factory method used to create the chain. |
protected abstract Class<?>[] |
getChain()
Returns the chain of TestExecutionListener classes in the correct order. |
void |
prepareTestInstance(org.springframework.test.context.TestContext testContext)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TestExecutionListenerChain
public TestExecutionListenerChain()
getChain
protected abstract Class<?>[] getChain()
- Returns the chain of
TestExecutionListener classes in the correct order.
- Returns:
- The chain
createChain
protected List<org.springframework.test.context.TestExecutionListener> createChain()
- Factory method used to create the chain. By default this method will construct the chain using the classes from
getChain().
- Returns:
- The chain
beforeTestClass
public void beforeTestClass(org.springframework.test.context.TestContext testContext)
throws Exception
- Specified by:
beforeTestClass in interface org.springframework.test.context.TestExecutionListener
- Throws:
Exception
prepareTestInstance
public void prepareTestInstance(org.springframework.test.context.TestContext testContext)
throws Exception
- Specified by:
prepareTestInstance in interface org.springframework.test.context.TestExecutionListener
- Throws:
Exception
beforeTestMethod
public void beforeTestMethod(org.springframework.test.context.TestContext testContext)
throws Exception
- Specified by:
beforeTestMethod in interface org.springframework.test.context.TestExecutionListener
- Throws:
Exception
afterTestMethod
public void afterTestMethod(org.springframework.test.context.TestContext testContext)
throws Exception
- Specified by:
afterTestMethod in interface org.springframework.test.context.TestExecutionListener
- Throws:
Exception
afterTestClass
public void afterTestClass(org.springframework.test.context.TestContext testContext)
throws Exception
- Specified by:
afterTestClass in interface org.springframework.test.context.TestExecutionListener
- Throws:
Exception
Copyright © 2012. All Rights Reserved.