TestPropertyValues

Test utilities for adding properties. Properties can be applied to a Spring Environment or to the system environment.

Author

Madhura Bhave

Phillip Webb

Stephane Nicoll

Since

2.0.0

Types

Link copied to clipboard
class Pair
A single name value pair.
Link copied to clipboard
enum Type
The type of property source.

Functions

Link copied to clipboard
open fun and(pairs: Array<String>): TestPropertyValues
open fun and(pairs: Stream<String>): TestPropertyValues
open fun <T> and(stream: Stream<T>, mapper: (T) -> TestPropertyValues.Pair): TestPropertyValues
Return a new TestPropertyValues instance with additional entries.
Link copied to clipboard
Add the properties from the underlying map to the environment owned by an ApplicationContext.
open fun applyTo(environment: ConfigurableEnvironment)
Add the properties from the underlying map to the environment.
Add the properties from the underlying map to the environment using the specified property source type.
open fun applyTo(environment: ConfigurableEnvironment, type: TestPropertyValues.Type, name: String)
Add the properties from the underlying map to the environment using the specified property source type and name.
Link copied to clipboard
Add the properties to the system properties for the duration of the action, restoring previous values when it completes.
open fun <T> applyToSystemProperties(call: Callable<T>): T
Add the properties to the system properties for the duration of the call, restoring previous values when it completes.
Link copied to clipboard
Return an empty TestPropertyValues instance.
Link copied to clipboard
open fun of(pairs: Array<String>): TestPropertyValues
open fun of(pairs: Stream<String>): TestPropertyValues
Return a new TestPropertyValues with the underlying map populated with the given property pairs.
Return a new TestPropertyValues with the underlying map populated with the given map entries.
open fun <T> of(stream: Stream<T>, mapper: (T) -> TestPropertyValues.Pair): TestPropertyValues
Return a new TestPropertyValues with the underlying map populated with the given stream.