|
spring-test | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.test.context.support.DirtiesContextTestExecutionListener
public class DirtiesContextTestExecutionListener
TestExecutionListener
which provides support for marking the
ApplicationContext
associated with a test as dirty for
both test classes and test methods configured with the @DirtiesContext
annotation.
DirtiesContext
Constructor Summary | |
---|---|
DirtiesContextTestExecutionListener()
|
Method Summary | |
---|---|
void |
afterTestClass(TestContext testContext)
If the test class of the supplied test context is
annotated with @DirtiesContext , the
application context of the test context will
be marked as dirty ,
and the
REINJECT_DEPENDENCIES_ATTRIBUTE in the test context will be set to
true . |
void |
afterTestMethod(TestContext testContext)
If the current test method of the supplied test
context is annotated with @DirtiesContext ,
or if the test class is annotated with @DirtiesContext and the class
mode is set to AFTER_EACH_TEST_METHOD , the application
context of the test context will be
marked as dirty and the
REINJECT_DEPENDENCIES_ATTRIBUTE in the test context will be set to
true . |
protected void |
dirtyContext(TestContext testContext)
Marks the application context of the supplied
test context as
dirty , and sets the
REINJECT_DEPENDENCIES_ATTRIBUTE in the test context to true . |
Methods inherited from class org.springframework.test.context.support.AbstractTestExecutionListener |
---|
beforeTestClass, beforeTestMethod, prepareTestInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirtiesContextTestExecutionListener()
Method Detail |
---|
protected void dirtyContext(TestContext testContext)
application context
of the supplied
test context
as
dirty
, and sets the
REINJECT_DEPENDENCIES_ATTRIBUTE
in the test context to true
.
public void afterTestMethod(TestContext testContext) throws java.lang.Exception
test
context
is annotated with @DirtiesContext
,
or if the test class is annotated with @DirtiesContext
and the class
mode
is set to AFTER_EACH_TEST_METHOD
, the application
context
of the test context will be
marked as dirty
and the
REINJECT_DEPENDENCIES_ATTRIBUTE
in the test context will be set to
true
.
afterTestMethod
in interface TestExecutionListener
afterTestMethod
in class AbstractTestExecutionListener
testContext
- the test context in which the test method was
executed; never null
java.lang.Exception
- allows any exception to propagatepublic void afterTestClass(TestContext testContext) throws java.lang.Exception
test context
is
annotated with @DirtiesContext
, the
application context
of the test context will
be marked as dirty
,
and the
REINJECT_DEPENDENCIES_ATTRIBUTE
in the test context will be set to
true
.
afterTestClass
in interface TestExecutionListener
afterTestClass
in class AbstractTestExecutionListener
testContext
- the test context for the test; never null
java.lang.Exception
- allows any exception to propagate
|
spring-test | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |