public final class ReactiveWebApplicationContextTester extends Object
ApplicationContext tester
for a
ConfigurableReactiveWebApplicationContext
.
See AbstractApplicationContextTester
for details.
Constructor and Description |
---|
ReactiveWebApplicationContextTester()
Create a new
ReactiveWebApplicationContextTester instance using a
GenericReactiveWebApplicationContext as the underlying source. |
ReactiveWebApplicationContextTester(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory)
Create a new
ApplicationContextTester instance using the specified
contextFactory as the underlying source. |
Modifier and Type | Method and Description |
---|---|
void |
run(ContextConsumer<? super A> consumer)
Create and refresh a new
ApplicationContext based on the current state of
this loader. |
protected SELF |
self() |
SELF |
withClassLoader(ClassLoader classLoader)
Customize the
ClassLoader that the ApplicationContext should use. |
SELF |
withConfiguration(Configurations configurations)
Register the specified configuration classes with the
ApplicationContext . |
SELF |
withParent(ApplicationContext parent)
Configure the
parent of the ApplicationContext . |
SELF |
withPropertyValue(String name,
String value)
Add the specified
Environment property. |
SELF |
withPropertyValues(String... pairs)
Add the specified
Environment property pairs. |
SELF |
withSystemProperties(String... pairs)
Add the specified
System property pairs. |
SELF |
withSystemProperty(String name,
String value)
Add the specified
System property. |
SELF |
withUserConfiguration(Class<?>... configurationClasses)
Register the specified user configuration classes with the
ApplicationContext . |
public ReactiveWebApplicationContextTester()
ReactiveWebApplicationContextTester
instance using a
GenericReactiveWebApplicationContext
as the underlying source.public ReactiveWebApplicationContextTester(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory)
ApplicationContextTester
instance using the specified
contextFactory
as the underlying source.contextFactory
- a supplier that returns a new instance on each callpublic SELF withPropertyValues(String... pairs)
Environment
property pairs. Key-value pairs can be
specified with colon (":") or equals ("=") separators. Override matching keys that
might have been specified previously.pairs
- the key-value pairs for properties that need to be added to the
environmentTestPropertyValues
,
withSystemProperties(String...)
public SELF withPropertyValue(String name, String value)
Environment
property.name
- the name of the propertyvalue
- the value of the propertyTestPropertyValues
,
withSystemProperties(String...)
public SELF withSystemProperties(String... pairs)
System
property pairs. Key-value pairs can be specified
with colon (":") or equals ("=") separators. System properties are added before the
context is run
and restored when the context is
closed.pairs
- the key-value pairs for properties that need to be added to the systemTestPropertyValues
,
withSystemProperties(String...)
public SELF withSystemProperty(String name, String value)
System
property. System properties are added before the
context is run
and restored when the context is
closed.name
- the property namevalue
- the property valueTestPropertyValues
,
withSystemProperties(String...)
public SELF withClassLoader(ClassLoader classLoader)
ClassLoader
that the ApplicationContext
should use.
Customizing the ClassLoader
is an effective manner to hide resources from
the classpath.classLoader
- the classloader to use (can be null to use the default)HidePackagesClassLoader
public SELF withParent(ApplicationContext parent)
parent
of the ApplicationContext
.parent
- the parentpublic SELF withUserConfiguration(Class<?>... configurationClasses)
ApplicationContext
.configurationClasses
- the user configuration classes to addpublic SELF withConfiguration(Configurations configurations)
ApplicationContext
.configurations
- the configurations to addprotected final SELF self()
public void run(ContextConsumer<? super A> consumer)
ApplicationContext
based on the current state of
this loader. The context is consumed by the specified consumer
and closed
upon completion.consumer
- the consumer of the created ApplicationContext
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.