public interface AssertableWebApplicationContext extends WebApplicationContext
WebApplicationContext
that additionally supports AssertJ style assertions.
Can be used to decorate and existing servlet web application context or an application
context that failed to start.
See AssertProviderApplicationContext
for more details.
WebApplicationContextTester
,
WebApplicationContext
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
Modifier and Type | Method and Description |
---|---|
ApplicationContextAssert<C> |
assertThat()
Deprecated.
use standard AssertJ
assertThat(context)... calls instead. |
void |
close() |
static <T extends org.springframework.boot.test.context.AssertProviderApplicationContext<C>,C extends ApplicationContext> |
get(Class<T> type,
Class<? extends C> contextType,
Supplier<? extends C> contextSupplier)
Factory method to create a new
AssertProviderApplicationContext instance. |
static AssertableWebApplicationContext |
get(Supplier<? extends ConfigurableWebApplicationContext> contextSupplier)
Factory method to create a new
AssertableWebApplicationContext instance. |
C |
getSourceApplicationContext()
Return the original source
ApplicationContext . |
<T extends C> |
getSourceApplicationContext(Class<T> requiredType)
Return the original source
ApplicationContext , casting it to the requested
type. |
Throwable |
getStartupFailure()
Return the failure that caused application context to fail or
null if the
context started without issue. |
getServletContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
getEnvironment
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
containsLocalBean, getParentBeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
getMessage, getMessage, getMessage
publishEvent, publishEvent
getResources
getClassLoader, getResource
static AssertableWebApplicationContext get(Supplier<? extends ConfigurableWebApplicationContext> contextSupplier)
AssertableWebApplicationContext
instance.contextSupplier
- a supplier that will either return a fully configured
ConfigurableWebApplicationContext
or throw an exception if the context
fails to start.AssertableWebApplicationContext
instance@Deprecated ApplicationContextAssert<C> assertThat()
assertThat(context)...
calls instead.assertThat
in interface org.assertj.core.api.AssertProvider<ApplicationContextAssert<C extends ApplicationContext>>
C getSourceApplicationContext()
ApplicationContext
.IllegalStateException
- if the source context failed to start<T extends C> T getSourceApplicationContext(Class<T> requiredType)
ApplicationContext
, casting it to the requested
type.T
- the context typerequiredType
- the required context typeIllegalStateException
- if the source context failed to startThrowable getStartupFailure()
null
if the
context started without issue.null
void close()
close
in interface AutoCloseable
close
in interface Closeable
static <T extends org.springframework.boot.test.context.AssertProviderApplicationContext<C>,C extends ApplicationContext> T get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier)
AssertProviderApplicationContext
instance.T
- the assert provider typeC
- the context typetype
- the type of AssertProviderApplicationContext
required (must be
an interface)contextType
- the type of ApplicationContext
being managed (must be an
interface)contextSupplier
- a supplier that will either return a fully configured
ApplicationContext
or throw an exception if the context fails to start.AssertProviderApplicationContext
instanceCopyright © 2017 Pivotal Software, Inc.. All rights reserved.