接口 ApplicationContextAssertProvider<C extends org.springframework.context.ApplicationContext>
- 类型参数:
C- the application context type
- 所有超级接口:
org.springframework.context.ApplicationContext,org.springframework.context.ApplicationEventPublisher,org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>,AutoCloseable,org.springframework.beans.factory.BeanFactory,Closeable,org.springframework.core.env.EnvironmentCapable,org.springframework.beans.factory.HierarchicalBeanFactory,org.springframework.beans.factory.ListableBeanFactory,org.springframework.context.MessageSource,org.springframework.core.io.ResourceLoader,org.springframework.core.io.support.ResourcePatternResolver
- 所有已知子接口:
AssertableApplicationContext,AssertableReactiveWebApplicationContext,AssertableWebApplicationContext
public interface ApplicationContextAssertProvider<C extends org.springframework.context.ApplicationContext> extends org.springframework.context.ApplicationContext, org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>, Closeable
AnApplicationContextthat additionally supports AssertJ style assertions. Can be used to decorate an existing application context or an application context that failed to start.Assertions can be applied using the standard AssertJ
assertThat(...)style (seeApplicationContextAssertfor a complete list). For example:assertThat(applicationContext).hasSingleBean(MyBean.class);
If the original
ApplicationContextis needed for any reason thegetSourceApplicationContext()method can be used.Any
ApplicationContextmethod called on a context that has failed to start will throw anIllegalStateException.
方法概要
所有方法 静态方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 ApplicationContextAssert<C>assertThat()已过时。use standard AssertJassertThat(context)...calls instead.voidclose()static <T extends ApplicationContextAssertProvider<C>,C extends org.springframework.context.ApplicationContext>
Tget(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier)Factory method to create a newApplicationContextAssertProviderinstance.CgetSourceApplicationContext()Return the original sourceApplicationContext.<T extends C>
TgetSourceApplicationContext(Class<T> requiredType)Return the original sourceApplicationContext, casting it to the requested type.ThrowablegetStartupFailure()Return the failure that caused application context to fail ornullif the context started without issue.从接口继承的方法 org.springframework.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
从接口继承的方法 org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
从接口继承的方法 org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
从接口继承的方法 org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
方法详细资料
assertThat
@Deprecated ApplicationContextAssert<C> assertThat()
已过时。use standard AssertJassertThat(context)...calls instead.Return an assert for AspectJ.- 指定者:
assertThat在接口中org.assertj.core.api.AssertProvider<C extends org.springframework.context.ApplicationContext>- 返回:
- an AspectJ assert
getSourceApplicationContext
C getSourceApplicationContext()
Return the original sourceApplicationContext.- 返回:
- the source application context
- 抛出:
IllegalStateException- if the source context failed to start
getSourceApplicationContext
<T extends C> T getSourceApplicationContext(Class<T> requiredType)
Return the original sourceApplicationContext, casting it to the requested type.- 类型参数:
T- the context type- 参数:
requiredType- the required context type- 返回:
- the source application context
- 抛出:
IllegalStateException- if the source context failed to start
getStartupFailure
Throwable getStartupFailure()
Return the failure that caused application context to fail ornullif the context started without issue.- 返回:
- the startup failure or
null
close
void close()
- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable
get
static <T extends ApplicationContextAssertProvider<C>,C extends org.springframework.context.ApplicationContext> T get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier)
Factory method to create a newApplicationContextAssertProviderinstance.- 类型参数:
T- the assert provider typeC- the context type- 参数:
type- the type ofApplicationContextAssertProviderrequired (must be an interface)contextType- the type ofApplicationContextbeing managed (must be an interface)contextSupplier- a supplier that will either return a fully configuredApplicationContextor throw an exception if the context fails to start.- 返回:
- a
ApplicationContextAssertProviderinstance