Class WebTestContextBootstrapper
- java.lang.Object
- org.springframework.test.context.support.AbstractTestContextBootstrapper
- org.springframework.test.context.support.DefaultTestContextBootstrapper
- org.springframework.test.context.web.WebTestContextBootstrapper
- All Implemented Interfaces:
TestContextBootstrapper
public class WebTestContextBootstrapper extends DefaultTestContextBootstrapper
Web-specific implementation of theTestContextBootstrapper
SPI.- Uses
WebDelegatingSmartContextLoader
as the defaultContextLoader
if the test class is annotated with@WebAppConfiguration
and otherwise delegates to the superclass. - Builds a
WebMergedContextConfiguration
if the test class is annotated with@WebAppConfiguration
.
- Since:
- 4.1
- Author:
- Sam Brannen
Constructor Summary
Constructors Constructor Description WebTestContextBootstrapper()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<? extends ContextLoader>
getDefaultContextLoaderClass(Class<?> testClass)
ReturnsWebDelegatingSmartContextLoader
if the supplied class is annotated with@WebAppConfiguration
and otherwise delegates to the superclass.protected MergedContextConfiguration
processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Returns aWebMergedContextConfiguration
if the test class in the suppliedMergedContextConfiguration
is annotated with@WebAppConfiguration
and otherwise returns the supplied instance unmodified.Methods inherited from class org.springframework.test.context.support.AbstractTestContextBootstrapper
buildMergedContextConfiguration, buildTestContext, getBootstrapContext, getCacheAwareContextLoaderDelegate, getContextCustomizerFactories, getDefaultTestExecutionListenerClasses, getDefaultTestExecutionListenerClassNames, getTestExecutionListeners, resolveContextLoader, resolveExplicitContextLoaderClass, setBootstrapContext
Constructor Detail
WebTestContextBootstrapper
public WebTestContextBootstrapper()
Method Detail
getDefaultContextLoaderClass
protected Class<? extends ContextLoader> getDefaultContextLoaderClass(Class<?> testClass)
ReturnsWebDelegatingSmartContextLoader
if the supplied class is annotated with@WebAppConfiguration
and otherwise delegates to the superclass.- Overrides:
getDefaultContextLoaderClass
in classDefaultTestContextBootstrapper
- Parameters:
testClass
- the test class for which to retrieve the defaultContextLoader
class- Returns:
- the default
ContextLoader
class for the supplied test class (nevernull
)
processMergedContextConfiguration
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Returns aWebMergedContextConfiguration
if the test class in the suppliedMergedContextConfiguration
is annotated with@WebAppConfiguration
and otherwise returns the supplied instance unmodified.- Overrides:
processMergedContextConfiguration
in classAbstractTestContextBootstrapper
- Parameters:
mergedConfig
- theMergedContextConfiguration
to process; nevernull
- Returns:
- a fully initialized
MergedContextConfiguration
; nevernull