| 
 | ||||||||||
| 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.DependencyInjectionTestExecutionListener
public class DependencyInjectionTestExecutionListener
TestExecutionListener which provides support for dependency
 injection and initialization of test instances.
| Field Summary | |
|---|---|
| static String | REINJECT_DEPENDENCIES_ATTRIBUTEAttribute name for a TestContextattribute which indicates
 whether or not the dependencies of a test instance should be
 reinjected inbeforeTestMethod(). | 
| Constructor Summary | |
|---|---|
| DependencyInjectionTestExecutionListener() | |
| Method Summary | |
|---|---|
|  void | beforeTestMethod(TestContext testContext)If the REINJECT_DEPENDENCIES_ATTRIBUTEin the suppliedtest contexthas a value ofBoolean.TRUE,
 this method will have the same effect asprepareTestInstance();
 otherwise, this method will have no effect. | 
| protected  void | injectDependencies(TestContext testContext)Performs dependency injection and bean initialization for the supplied TestContextas described inprepareTestInstance(). | 
|  void | prepareTestInstance(TestContext testContext)Performs dependency injection on the test instanceof the suppliedtest contextbyautowiringandinitializingthe test instance via its ownapplication context(without
 checking dependencies). | 
| Methods inherited from class org.springframework.test.context.support.AbstractTestExecutionListener | 
|---|
| afterTestMethod | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String REINJECT_DEPENDENCIES_ATTRIBUTE
TestContext attribute which indicates
 whether or not the dependencies of a test instance should be
 reinjected in
 beforeTestMethod(). Note that
 dependencies will be injected in
 prepareTestInstance() in any
 case.
 Clients of a TestContext (e.g., other
 TestExecutionListeners)
 may therefore choose to set this attribute to signal that dependencies
 should be reinjected between execution of individual test
 methods.
 
Permissible values include Boolean.TRUE and Boolean.FALSE.
| Constructor Detail | 
|---|
public DependencyInjectionTestExecutionListener()
| Method Detail | 
|---|
public void prepareTestInstance(TestContext testContext)
                         throws Exception
test instance of the supplied
 test context by
 autowiring
 and
 initializing
 the test instance via its own
 application context (without
 checking dependencies).
 The REINJECT_DEPENDENCIES_ATTRIBUTE will be subsequently removed
 from the test context, regardless of its value.
prepareTestInstance in interface TestExecutionListenerprepareTestInstance in class AbstractTestExecutionListenertestContext - the test context for the test (never null)
Exception - allows any exception to propagate
public void beforeTestMethod(TestContext testContext)
                      throws Exception
REINJECT_DEPENDENCIES_ATTRIBUTE in the supplied
 test context has a value of Boolean.TRUE,
 this method will have the same effect as
 prepareTestInstance();
 otherwise, this method will have no effect.
beforeTestMethod in interface TestExecutionListenerbeforeTestMethod in class AbstractTestExecutionListenertestContext - the test context in which the test method will be
 executed (never null)
Exception - allows any exception to propagate
protected void injectDependencies(TestContext testContext)
                           throws Exception
TestContext as described in
 prepareTestInstance().
 The REINJECT_DEPENDENCIES_ATTRIBUTE will be subsequently removed
 from the test context, regardless of its value.
testContext - the test context for which dependency injection should
 be performed (never null)
Exception - allows any exception to propagateprepareTestInstance(TestContext), 
beforeTestMethod(TestContext)| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||