abstract class BootstrapUtils
extends java.lang.Object
BootstrapUtils
is a collection of utility methods to assist with
bootstrapping the Spring TestContext Framework.BootstrapWith
,
BootstrapContext
,
TestContextBootstrapper
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_BOOTSTRAP_CONTEXT_CLASS_NAME |
private static java.lang.String |
DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME |
private static java.lang.String |
DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME |
private static java.lang.String |
DEFAULT_WEB_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME |
private static Log |
logger |
private static java.lang.String |
WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME |
Constructor and Description |
---|
BootstrapUtils() |
Modifier and Type | Method and Description |
---|---|
(package private) static BootstrapContext |
createBootstrapContext(java.lang.Class<?> testClass)
Create the
BootstrapContext for the specified test class. |
private static CacheAwareContextLoaderDelegate |
createCacheAwareContextLoaderDelegate() |
private static java.lang.Class<?> |
resolveDefaultTestContextBootstrapper(java.lang.Class<?> testClass) |
private static java.lang.Class<?> |
resolveExplicitTestContextBootstrapper(java.lang.Class<?> testClass) |
(package private) static TestContextBootstrapper |
resolveTestContextBootstrapper(BootstrapContext bootstrapContext)
Resolve the
TestContextBootstrapper type for the test class in the
supplied BootstrapContext , instantiate it, and provide it a reference
to the BootstrapContext . |
private static final java.lang.String DEFAULT_BOOTSTRAP_CONTEXT_CLASS_NAME
private static final java.lang.String DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME
private static final java.lang.String DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME
private static final java.lang.String DEFAULT_WEB_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME
private static final java.lang.String WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME
private static final Log logger
static BootstrapContext createBootstrapContext(java.lang.Class<?> testClass)
BootstrapContext
for the specified test class.
Uses reflection to create a DefaultBootstrapContext
that uses a DefaultCacheAwareContextLoaderDelegate
.
testClass
- the test class for which the bootstrap context should be createdBootstrapContext
; never null
private static CacheAwareContextLoaderDelegate createCacheAwareContextLoaderDelegate()
static TestContextBootstrapper resolveTestContextBootstrapper(BootstrapContext bootstrapContext)
TestContextBootstrapper
type for the test class in the
supplied BootstrapContext
, instantiate it, and provide it a reference
to the BootstrapContext
.
If the @BootstrapWith
annotation is present on
the test class, either directly or as a meta-annotation, then its
value
will be used as the bootstrapper type.
Otherwise, either the
DefaultTestContextBootstrapper
or the
WebTestContextBootstrapper
will be used, depending on the presence of
@WebAppConfiguration
.
bootstrapContext
- the bootstrap context to useTestContextBootstrapper
private static java.lang.Class<?> resolveExplicitTestContextBootstrapper(java.lang.Class<?> testClass)
private static java.lang.Class<?> resolveDefaultTestContextBootstrapper(java.lang.Class<?> testClass) throws java.lang.Exception
java.lang.Exception