ApplicationContextAssertProvider

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.

Author

Phillip Webb

Since

2.0.0

Parameters

<C>

the application context type

See also

Inheritors

Properties

Link copied to clipboard
val CLASSPATH_ALL_URL_PREFIX: String = "classpath*:"
Link copied to clipboard
val CLASSPATH_URL_PREFIX: String = "classpath:"
Link copied to clipboard

Functions

Link copied to clipboard
Return an assert for AspectJ.
Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract fun containsBean(name: String): Boolean
Link copied to clipboard
abstract fun containsBeanDefinition(beanName: String): Boolean
Link copied to clipboard
abstract fun containsLocalBean(name: String): Boolean
Link copied to clipboard
abstract fun <A : Annotation?> findAllAnnotationsOnBean(beanName: String, annotationType: Class<A>, allowFactoryBeanInit: Boolean): Set<A>
Link copied to clipboard
abstract fun <A : Annotation?> findAnnotationOnBean(beanName: String, annotationType: Class<A>): A
Link copied to clipboard
open fun <T : ApplicationContextAssertProvider<C>?, C : ApplicationContext?> get(type: Class<T>, contextType: Class<out C>, contextSupplier: Supplier<out C>): T
open fun <T : ApplicationContextAssertProvider<C>?, C : ApplicationContext?> get(type: Class<T>, contextType: Class<out C>, contextSupplier: Supplier<out C>, additionalContextInterfaces: Array<Class<out Any>>): T
Factory method to create a new ApplicationContextAssertProvider instance.
Link copied to clipboard
abstract fun getAliases(name: String): Array<String>
Link copied to clipboard
abstract fun getApplicationName(): String
Link copied to clipboard
abstract fun getBean(name: String): Any
abstract fun <T> getBean(name: String, requiredType: Class<T>): T
Link copied to clipboard
abstract fun getBeanDefinitionCount(): Int
Link copied to clipboard
Link copied to clipboard
abstract fun getBeanNamesForAnnotation(annotationType: Class<out Annotation>): Array<String>
Link copied to clipboard
Link copied to clipboard
abstract fun <T> getBeanProvider(requiredType: Class<T>, allowEagerInit: Boolean): ObjectProvider<T>
Link copied to clipboard
abstract fun <T> getBeansOfType(type: Class<T>): Map<String, T>
Link copied to clipboard
abstract fun getBeansWithAnnotation(annotationType: Class<out Annotation>): Map<String, Any>
Link copied to clipboard
abstract fun getClassLoader(): ClassLoader
Link copied to clipboard
abstract fun getDisplayName(): String
Link copied to clipboard
abstract fun getEnvironment(): Environment
Link copied to clipboard
abstract fun getId(): String
Link copied to clipboard
abstract fun getMessage(code: String, args: Array<Any>, defaultMessage: String, locale: Locale): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun getResource(location: String): Resource
Link copied to clipboard
abstract fun getResources(locationPattern: String): Array<Resource>
Link copied to clipboard
Return the original source ApplicationContext.
abstract fun <T : C?> getSourceApplicationContext(requiredType: Class<T>): T
Return the original source ApplicationContext, casting it to the requested type.
Link copied to clipboard
abstract fun getStartupDate(): Long
Link copied to clipboard
Return the failure that caused application context to fail or null if the context started without issue.
Link copied to clipboard
abstract fun getType(name: String): Class<out Any>
Link copied to clipboard
abstract fun isPrototype(name: String): Boolean
Link copied to clipboard
abstract fun isSingleton(name: String): Boolean
Link copied to clipboard
abstract fun isTypeMatch(name: String, typeToMatch: ResolvableType): Boolean
Link copied to clipboard