public abstract class TestExecutionListenerChain extends Object implements org.springframework.test.context.TestExecutionListener
TestExecutionListener
implementation that works by chaining together other TestExecutionListener
s
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
.
Constructor and Description |
---|
TestExecutionListenerChain() |
Modifier and Type | Method and Description |
---|---|
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) |
protected abstract Class<?>[] getChain()
TestExecutionListener
classes in the correct order.protected List<org.springframework.test.context.TestExecutionListener> createChain()
getChain()
.public void beforeTestClass(org.springframework.test.context.TestContext testContext) throws Exception
beforeTestClass
in interface org.springframework.test.context.TestExecutionListener
Exception
public void prepareTestInstance(org.springframework.test.context.TestContext testContext) throws Exception
prepareTestInstance
in interface org.springframework.test.context.TestExecutionListener
Exception
public void beforeTestMethod(org.springframework.test.context.TestContext testContext) throws Exception
beforeTestMethod
in interface org.springframework.test.context.TestExecutionListener
Exception
public void afterTestMethod(org.springframework.test.context.TestContext testContext) throws Exception
afterTestMethod
in interface org.springframework.test.context.TestExecutionListener
Exception
Copyright © 2016. All rights reserved.