@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2014 the original author or authors .
* Copyright 2002 - 2015 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -29,15 +29,14 @@ import java.util.List;
@@ -29,15 +29,14 @@ import java.util.List;
*
* < p > The { @link TestContextManager } uses a { @code TestContextBootstrapper } to
* { @linkplain # getTestExecutionListeners get the TestExecutionListeners } for the
* current test and to { @linkplain # buildMergedContextConfiguration build the
* merged context configuration } necessary to create the { @link TestContext } that
* current test and to { @linkplain # buildTestContext build the TestContext } that
* it manages .
*
* < p > Concrete implementations must provide a { @code public } no - args constructor .
*
* < p > < strong > Note < / strong > : this SPI might potential ly change in the future in
* < p > < strong > WARNING < / strong > : this SPI will like ly change in the future in
* order to accommodate new requirements . Implementers are therefore strongly encouraged
* < em > not < / em > to implement this interface directly but rather to < em > extend < / em >
* < strong > not < / strong > to implement this interface directly but rather to < em > extend < / em >
* { @link org . springframework . test . context . support . AbstractTestContextBootstrapper
* AbstractTestContextBootstrapper } or one of its concrete subclasses instead .
*
@ -59,28 +58,13 @@ public interface TestContextBootstrapper {
@@ -59,28 +58,13 @@ public interface TestContextBootstrapper {
BootstrapContext getBootstrapContext ( ) ;
/ * *
* Get a list of newly instantiated { @link TestExecutionListener TestExecutionListeners }
* for the test class in the { @link BootstrapContext } associated with this bootstrapper .
* < p > If { @link TestExecutionListeners @TestExecutionListeners } is not
* < em > present < / em > on the test class in the { @code BootstrapContext } ,
* < em > default < / em > listeners should be returned . Furthermore , default
* listeners must be sorted using
* { @link org . springframework . core . annotation . AnnotationAwareOrderComparator
* AnnotationAwareOrderComparator } .
* < p > Concrete implementations are free to determine what comprises the
* set of default listeners . However , by default , the Spring TestContext
* Framework will use the
* { @link org . springframework . core . io . support . SpringFactoriesLoader SpringFactoriesLoader }
* mechanism to look up all { @code TestExecutionListener } class names
* configured in all { @code META - INF / spring . factories } files on the classpath .
* < p > The { @link TestExecutionListeners # inheritListeners ( ) inheritListeners }
* flag of { @link TestExecutionListeners @TestExecutionListeners } must be
* taken into consideration . Specifically , if the { @code inheritListeners }
* flag is set to { @code true } , listeners declared for a given test class must
* be appended to the end of the list of listeners declared in superclasses .
* @return a list of { @code TestExecutionListener } instances
* Build the { @link TestContext } for the { @link BootstrapContext }
* associated with this bootstrapper .
* @return a new { @link TestContext } , never { @code null }
* @since 4 . 2
* @see # buildMergedContextConfiguration ( )
* /
List < TestExecutionListener > getTestExecutionListeners ( ) ;
TestContext buildTestContext ( ) ;
/ * *
* Build the { @linkplain MergedContextConfiguration merged context configuration }
@ -94,9 +78,12 @@ public interface TestContextBootstrapper {
@@ -94,9 +78,12 @@ public interface TestContextBootstrapper {
* < li > Active bean definition profiles declared via { @link ActiveProfiles @ActiveProfiles } < / li >
* < li > { @linkplain org . springframework . context . ApplicationContextInitializer
* Context initializers } declared via { @link ContextConfiguration # initializers } < / li >
* < li > Test property sources declared via { @link TestPropertySource @TestPropertySource } < / li >
* < / ul >
* < p > Consult the Javadoc for the aforementioned annotations for details on
* the required semantics .
* < p > Note that the implementation of { @link # buildTestContext ( ) } should
* typically delegate to this method when constructing the { @code TestContext } .
* < p > When determining which { @link ContextLoader } to use for a given test
* class , the following algorithm should be used :
* < ol >
@ -106,7 +93,32 @@ public interface TestContextBootstrapper {
@@ -106,7 +93,32 @@ public interface TestContextBootstrapper {
* { @code ContextLoader } class to use as as default . < / li >
* < / ol >
* @return the merged context configuration , never { @code null }
* @see # buildTestContext ( )
* /
MergedContextConfiguration buildMergedContextConfiguration ( ) ;
/ * *
* Get a list of newly instantiated { @link TestExecutionListener TestExecutionListeners }
* for the test class in the { @link BootstrapContext } associated with this bootstrapper .
* < p > If { @link TestExecutionListeners @TestExecutionListeners } is not
* < em > present < / em > on the test class in the { @code BootstrapContext } ,
* < em > default < / em > listeners should be returned . Furthermore , default
* listeners must be sorted using
* { @link org . springframework . core . annotation . AnnotationAwareOrderComparator
* AnnotationAwareOrderComparator } .
* < p > Concrete implementations are free to determine what comprises the
* set of default listeners . However , by default , the Spring TestContext
* Framework will use the
* { @link org . springframework . core . io . support . SpringFactoriesLoader SpringFactoriesLoader }
* mechanism to look up all { @code TestExecutionListener } class names
* configured in all { @code META - INF / spring . factories } files on the classpath .
* < p > The { @link TestExecutionListeners # inheritListeners ( ) inheritListeners }
* flag of { @link TestExecutionListeners @TestExecutionListeners } must be
* taken into consideration . Specifically , if the { @code inheritListeners }
* flag is set to { @code true } , listeners declared for a given test class must
* be appended to the end of the list of listeners declared in superclasses .
* @return a list of { @code TestExecutionListener } instances
* /
List < TestExecutionListener > getTestExecutionListeners ( ) ;
}