public interface AssertableApplicationContext
ApplicationContext
that additionally supports AssertJ style assertions. Can
be used to decorate and existing application context or an application context that
failed to start.
See AssertProviderApplicationContext
for more details.
ApplicationContextTester
,
ApplicationContext
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 AssertableApplicationContext |
get(Supplier<? extends ConfigurableApplicationContext> contextSupplier)
Factory method to create a new
AssertableApplicationContext 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. |
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 AssertableApplicationContext get(Supplier<? extends ConfigurableApplicationContext> contextSupplier)
AssertableApplicationContext
instance.contextSupplier
- a supplier that will either return a fully configured
ConfigurableApplicationContext
or throw an exception if the context fails
to start.AssertableApplicationContext
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.