Interface ApplicationContextAssertProvider<C extends ApplicationContext>

Type Parameters:
C - the application context type
All Superinterfaces:
ApplicationContext, ApplicationEventPublisher, org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>, AutoCloseable, BeanFactory, Closeable, EnvironmentCapable, HierarchicalBeanFactory, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver
All Known Subinterfaces:
AssertableApplicationContext, AssertableReactiveWebApplicationContext, AssertableWebApplicationContext

public interface ApplicationContextAssertProvider<C extends ApplicationContext> extends ApplicationContext, org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>, Closeable
An ApplicationContext that 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 (see ApplicationContextAssert for a complete list). For example:

 assertThat(applicationContext).hasSingleBean(MyBean.class);
 

If the original ApplicationContext is needed for any reason the getSourceApplicationContext() method can be used.

Any ApplicationContext method called on a context that has failed to start will throw an IllegalStateException.

Since:
2.0.0
Author:
Phillip Webb
See Also:
  • Method Details