Package net.shibboleth.shared.testing

# Class MockApplicationContext

java.lang.Object
net.shibboleth.shared.testing.MockApplicationContext

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `BeanFactory`, `HierarchicalBeanFactory`, `ListableBeanFactory`, `ApplicationContext`, `ApplicationEventPublisher`, `ConfigurableApplicationContext`, `Lifecycle`, `MessageSource`, `EnvironmentCapable`, `ResourceLoader`, `ResourcePatternResolver`

public class MockApplicationContext extends Object implements ConfigurableApplicationContext
Placeholder, which can be set on test components to stop the "must be null" test firing.

## Field Summary

### Fields inherited from interface org.springframework.beans.factory.BeanFactory

`FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHAR`

### Fields inherited from interface org.springframework.context.ConfigurableApplicationContext

`APPLICATION_STARTUP_BEAN_NAME, BOOTSTRAP_EXECUTOR_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME`

### Fields inherited from interface org.springframework.core.io.ResourceLoader

`CLASSPATH_URL_PREFIX`

### Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver

`CLASSPATH_ALL_URL_PREFIX`

## Constructor Summary

Constructors
Constructor
Description
`MockApplicationContext()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addApplicationListener(ApplicationListener<?> listener)`
`void`
`addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor)`
`void`
`addProtocolResolver(ProtocolResolver resolver)`
`void`
`close()`
`boolean`
`containsBean(String name)`
`boolean`
`containsBeanDefinition(String beanName)`
`boolean`
`containsLocalBean(String name)`
`<A extends Annotation>
Set<A>`
`findAllAnnotationsOnBean(String beanName, Class<A> annotationType, boolean allowFactoryBeanInit)`
`<A extends Annotation>
A`
`findAnnotationOnBean(String beanName, Class<A> annotationType)`
`<A extends Annotation>
A`
`findAnnotationOnBean(String beanName, Class<A> annotationType, boolean allowFactoryBeanInit)`
`String[]`
`getAliases(String name)`
`String`
`getApplicationName()`
`ApplicationStartup`
`getApplicationStartup()`
`AutowireCapableBeanFactory`
`getAutowireCapableBeanFactory()`
`<T> T`
`getBean(Class<T> requiredType)`
`<T> T`
`getBean(Class<T> requiredType, Object... args)`
`Object`
`getBean(String name)`
`<T> T`
`getBean(String name, Class<T> requiredType)`
`Object`
`getBean(String name, Object... args)`
`int`
`getBeanDefinitionCount()`
`String[]`
`getBeanDefinitionNames()`
`ConfigurableListableBeanFactory`
`getBeanFactory()`
`String[]`
`getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)`
`String[]`
`getBeanNamesForType(Class<?> type)`
`String[]`
`getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)`
`String[]`
`getBeanNamesForType(ResolvableType type)`
`String[]`
`getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)`
`<T> ObjectProvider<T>`
`getBeanProvider(Class<T> requiredType)`
`<T> ObjectProvider<T>`
`getBeanProvider(Class<T> requiredType, boolean allowEagerInit)`
`<T> ObjectProvider<T>`
`getBeanProvider(ParameterizedTypeReference<T> requiredType)`
`<T> ObjectProvider<T>`
`getBeanProvider(ResolvableType requiredType)`
`<T> ObjectProvider<T>`
`getBeanProvider(ResolvableType requiredType, boolean allowEagerInit)`
`<T> Map<String,T>`
`getBeansOfType(Class<T> type)`
`<T> Map<String,T>`
`getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)`
`Map<String,Object>`
`getBeansWithAnnotation(Class<? extends Annotation> annotationType)`
`ClassLoader`
`getClassLoader()`
`String`
`getDisplayName()`
`ConfigurableEnvironment`
`getEnvironment()`
`String`
`getId()`
`String`
`getMessage(String code, Object[] args, String defaultMessage, Locale locale)`
`String`
`getMessage(String code, Object[] args, Locale locale)`
`String`
`getMessage(MessageSourceResolvable resolvable, Locale locale)`
`ApplicationContext`
`getParent()`
`BeanFactory`
`getParentBeanFactory()`
`Resource`
`getResource(String location)`
`Resource[]`
`getResources(String locationPattern)`
`long`
`getStartupDate()`
`Class<?>`
`getType(String name)`
`Class<?>`
`getType(String name, boolean allowFactoryBeanInit)`
`boolean`
`isActive()`
`boolean`
`isClosed()`
`boolean`
`isPrototype(String name)`
`boolean`
`isRunning()`
`boolean`
`isSingleton(String name)`
`boolean`
`isTypeMatch(String name, Class<?> typeToMatch)`
`boolean`
`isTypeMatch(String name, ResolvableType typeToMatch)`
`void`
`pause()`
`void`
`publishEvent(Object event)`
`void`
`refresh()`
`void`
`registerShutdownHook()`
`void`
`removeApplicationListener(ApplicationListener<?> listener)`
`void`
`restart()`
`void`
`setApplicationStartup(ApplicationStartup applicationStartup)`
`void`
`setClassLoader(ClassLoader classLoader)`
`void`
`setEnvironment(ConfigurableEnvironment environment)`
`void`
`setId(String id)`
`void`
`setParent(ApplicationContext parent)`
`void`
`start()`
`void`
`stop()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.context.ApplicationEventPublisher

`publishEvent`

## Constructor Details

### MockApplicationContext

public MockApplicationContext()

## Method Details

### getId

public String getId()

Specified by:
  `getId` in interface `ApplicationContext`

### getApplicationName

@Nonnull public String getApplicationName()

Specified by:
  `getApplicationName` in interface `ApplicationContext`

### getDisplayName

@Nonnull public String getDisplayName()

Specified by:
  `getDisplayName` in interface `ApplicationContext`

### getStartupDate

public long getStartupDate()

Specified by:
  `getStartupDate` in interface `ApplicationContext`

### getParent

public ApplicationContext getParent()

Specified by:
  `getParent` in interface `ApplicationContext`

### getAutowireCapableBeanFactory

@Nonnull public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException

Specified by:
  `getAutowireCapableBeanFactory` in interface `ApplicationContext`
Throws:
  `IllegalStateException`

### containsBeanDefinition

public boolean containsBeanDefinition(@Nonnull String beanName)

Specified by:
  `containsBeanDefinition` in interface `ListableBeanFactory`

### getBeanDefinitionCount

public int getBeanDefinitionCount()

Specified by:
  `getBeanDefinitionCount` in interface `ListableBeanFactory`

### getBeanDefinitionNames

@Nonnull public String[] getBeanDefinitionNames()

Specified by:
  `getBeanDefinitionNames` in interface `ListableBeanFactory`

### getBeanNamesForType

@Nonnull public String[] getBeanNamesForType(@Nonnull ResolvableType type)

Specified by:
  `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeanNamesForType

@Nonnull public String[] getBeanNamesForType(@Nonnull ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)

Specified by:
  `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeanNamesForType

@Nonnull public String[] getBeanNamesForType(@Nullable Class<?> type)

Specified by:
  `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeanNamesForType

@Nonnull public String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)

Specified by:
  `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeansOfType

@Nonnull public <T> Map<String,T> getBeansOfType(@Nullable Class<T> type) throws BeansException

Specified by:
  `getBeansOfType` in interface `ListableBeanFactory`
Throws:
  `BeansException`

### getBeansOfType

@Nonnull public <T> Map<String,T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException

Specified by:
  `getBeansOfType` in interface `ListableBeanFactory`
Throws:
  `BeansException`

### getBeanNamesForAnnotation

@Nonnull public String[] getBeanNamesForAnnotation(@Nonnull Class<? extends Annotation> annotationType)

Specified by:
  `getBeanNamesForAnnotation` in interface `ListableBeanFactory`

### getBeansWithAnnotation

@Nonnull public Map<String,Object> getBeansWithAnnotation(@Nonnull Class<? extends Annotation> annotationType) throws BeansException

Specified by:
  `getBeansWithAnnotation` in interface `ListableBeanFactory`
Throws:
  `BeansException`

### findAnnotationOnBean

public <A extends Annotation> A findAnnotationOnBean(@Nonnull String beanName, @Nonnull Class<A> annotationType) throws NoSuchBeanDefinitionException

Specified by:
  `findAnnotationOnBean` in interface `ListableBeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### getBean

@Nonnull public Object getBean(@Nonnull String name) throws BeansException

Specified by:
  `getBean` in interface `BeanFactory`
Throws:
  `BeansException`

### getBean

@Nonnull public <T> T getBean(@Nonnull String name, @Nonnull Class<T> requiredType) throws BeansException

Specified by:
  `getBean` in interface `BeanFactory`
Throws:
  `BeansException`

### getBean

@Nonnull public Object getBean(@Nonnull String name, @Nonnull Object... args) throws BeansException

Specified by:
  `getBean` in interface `BeanFactory`
Throws:
  `BeansException`

### getBean

@Nonnull public <T> T getBean(@Nonnull Class<T> requiredType) throws BeansException

Specified by:
  `getBean` in interface `BeanFactory`
Throws:
  `BeansException`

### getBean

@Nonnull public <T> T getBean(@Nonnull Class<T> requiredType, @Nonnull Object... args) throws BeansException

Specified by:
  `getBean` in interface `BeanFactory`
Throws:
  `BeansException`

### getBeanProvider

@Nonnull public <T> ObjectProvider<T> getBeanProvider(@Nonnull Class<T> requiredType)

Specified by:
  `getBeanProvider` in interface `BeanFactory`

### getBeanProvider

@Nonnull public <T> ObjectProvider<T> getBeanProvider(@Nonnull ResolvableType requiredType)

Specified by:
  `getBeanProvider` in interface `BeanFactory`

### getBeanProvider

public <T> ObjectProvider<T> getBeanProvider(ParameterizedTypeReference<T> requiredType)

Specified by:
  `getBeanProvider` in interface `BeanFactory`

### containsBean

public boolean containsBean(@Nonnull String name)

Specified by:
  `containsBean` in interface `BeanFactory`

### isSingleton

public boolean isSingleton(@Nonnull String name) throws NoSuchBeanDefinitionException

Specified by:
  `isSingleton` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### isPrototype

public boolean isPrototype(@Nonnull String name) throws NoSuchBeanDefinitionException

Specified by:
  `isPrototype` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### isTypeMatch

public boolean isTypeMatch(@Nonnull String name, @Nonnull ResolvableType typeToMatch) throws NoSuchBeanDefinitionException

Specified by:
  `isTypeMatch` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### isTypeMatch

public boolean isTypeMatch(@Nonnull String name, @Nonnull Class<?> typeToMatch) throws NoSuchBeanDefinitionException

Specified by:
  `isTypeMatch` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### getType

public Class<?> getType(@Nonnull String name) throws NoSuchBeanDefinitionException

Specified by:
  `getType` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### getType

public Class<?> getType(@Nonnull String name, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException

Specified by:
  `getType` in interface `BeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### getAliases

@Nonnull public String[] getAliases(@Nonnull String name)

Specified by:
  `getAliases` in interface `BeanFactory`

### getParentBeanFactory

public BeanFactory getParentBeanFactory()

Specified by:
  `getParentBeanFactory` in interface `HierarchicalBeanFactory`

### containsLocalBean

public boolean containsLocalBean(@Nonnull String name)

Specified by:
  `containsLocalBean` in interface `HierarchicalBeanFactory`

### getMessage

public String getMessage(@Nonnull String code, @Nullable Object[] args, @Nullable String defaultMessage, @Nullable Locale locale)

Specified by:
  `getMessage` in interface `MessageSource`

### getMessage

@Nonnull public String getMessage(@Nonnull String code, @Nullable Object[] args, @Nullable Locale locale) throws NoSuchMessageException

Specified by:
  `getMessage` in interface `MessageSource`
Throws:
  `NoSuchMessageException`

### getMessage

@Nonnull public String getMessage(@Nonnull MessageSourceResolvable resolvable, @Nullable Locale locale) throws NoSuchMessageException

Specified by:
  `getMessage` in interface `MessageSource`
Throws:
  `NoSuchMessageException`

### publishEvent

public void publishEvent(@Nonnull Object event)

Specified by:
  `publishEvent` in interface `ApplicationEventPublisher`

### getResources

@Nonnull public Resource[] getResources(@Nonnull String locationPattern) throws IOException

Specified by:
  `getResources` in interface `ResourcePatternResolver`
Throws:
  `IOException`

### getResource

@Nonnull public Resource getResource(@Nonnull String location)

Specified by:
  `getResource` in interface `ResourceLoader`

### getClassLoader

public ClassLoader getClassLoader()

Specified by:
  `getClassLoader` in interface `ResourceLoader`

### start

public void start()

Specified by:
  `start` in interface `Lifecycle`

### stop

public void stop()

Specified by:
  `stop` in interface `Lifecycle`

### isRunning

public boolean isRunning()

Specified by:
  `isRunning` in interface `Lifecycle`

### setId

public void setId(@Nonnull String id)

Specified by:
  `setId` in interface `ConfigurableApplicationContext`

### setParent

public void setParent(@Nullable ApplicationContext parent)

Specified by:
  `setParent` in interface `ConfigurableApplicationContext`

### setEnvironment

public void setEnvironment(@Nonnull ConfigurableEnvironment environment)

Specified by:
  `setEnvironment` in interface `ConfigurableApplicationContext`

### getEnvironment

@Nonnull public ConfigurableEnvironment getEnvironment()

Specified by:
  `getEnvironment` in interface `ConfigurableApplicationContext`
Specified by:
  `getEnvironment` in interface `EnvironmentCapable`

### addBeanFactoryPostProcessor

public void addBeanFactoryPostProcessor(@Nonnull BeanFactoryPostProcessor postProcessor)

Specified by:
  `addBeanFactoryPostProcessor` in interface `ConfigurableApplicationContext`

### addApplicationListener

public void addApplicationListener(@Nonnull ApplicationListener<?> listener)

Specified by:
  `addApplicationListener` in interface `ConfigurableApplicationContext`

### addProtocolResolver

public void addProtocolResolver(@Nonnull ProtocolResolver resolver)

Specified by:
  `addProtocolResolver` in interface `ConfigurableApplicationContext`

### refresh

public void refresh() throws BeansException, IllegalStateException

Specified by:
  `refresh` in interface `ConfigurableApplicationContext`
Throws:
  `BeansException`
  `IllegalStateException`

### restart

public void restart()

Specified by:
  `restart` in interface `ConfigurableApplicationContext`

### pause

public void pause()

Specified by:
  `pause` in interface `ConfigurableApplicationContext`

### registerShutdownHook

public void registerShutdownHook()

Specified by:
  `registerShutdownHook` in interface `ConfigurableApplicationContext`

### close

public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `ConfigurableApplicationContext`

### isClosed

public boolean isClosed()

Specified by:
  `isClosed` in interface `ConfigurableApplicationContext`

### isActive

public boolean isActive()

Specified by:
  `isActive` in interface `ConfigurableApplicationContext`

### getBeanFactory

@Nonnull public ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException

Specified by:
  `getBeanFactory` in interface `ConfigurableApplicationContext`
Throws:
  `IllegalStateException`

### setClassLoader

public void setClassLoader(@Nonnull ClassLoader classLoader)

Specified by:
  `setClassLoader` in interface `ConfigurableApplicationContext`

### getBeanProvider

@Nonnull public <T> ObjectProvider<T> getBeanProvider(@Nonnull Class<T> requiredType, boolean allowEagerInit)

Specified by:
  `getBeanProvider` in interface `ListableBeanFactory`

### getBeanProvider

@Nonnull public <T> ObjectProvider<T> getBeanProvider(@Nonnull ResolvableType requiredType, boolean allowEagerInit)

Specified by:
  `getBeanProvider` in interface `ListableBeanFactory`

### setApplicationStartup

public void setApplicationStartup(@Nonnull ApplicationStartup applicationStartup)

Specified by:
  `setApplicationStartup` in interface `ConfigurableApplicationContext`

### getApplicationStartup

@Nonnull public ApplicationStartup getApplicationStartup()

Specified by:
  `getApplicationStartup` in interface `ConfigurableApplicationContext`

### findAnnotationOnBean

public <A extends Annotation> A findAnnotationOnBean(@Nonnull String beanName, @Nonnull Class<A> annotationType, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException

Specified by:
  `findAnnotationOnBean` in interface `ListableBeanFactory`
Throws:
  `NoSuchBeanDefinitionException`

### removeApplicationListener

public void removeApplicationListener(@Nonnull ApplicationListener<?> listener)

Specified by:
  `removeApplicationListener` in interface `ConfigurableApplicationContext`

### findAllAnnotationsOnBean

@Nonnull public <A extends Annotation> Set<A> findAllAnnotationsOnBean(@Nonnull String beanName, @Nonnull Class<A> annotationType, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException

Specified by:
  `findAllAnnotationsOnBean` in interface `ListableBeanFactory`
Throws:
  `NoSuchBeanDefinitionException`