open class MockPropertySource : PropertiesPropertySource
Simple PropertySource implementation for use in testing. Accepts a user-provided Properties object, or if omitted during construction, the implementation will initialize its own. The #setProperty and #withProperty methods are exposed for convenience, for example:
PropertySource<?> source = new MockPropertySource().withProperty("foo", "bar");
Author
Chris Beams
Since
3.1
See Also
org.springframework.mock.env.MockEnvironment
MockPropertySource()
Create a new MockPropertySource(name: String)
Create a new MockPropertySource(properties: Properties)
Create a new MockPropertySource(name: String, properties: Properties)
Create a new |
static val MOCK_PROPERTIES_PROPERTY_SOURCE_NAME: String
{@value} is the default name for MockPropertySource instances not otherwise given an explicit name. |
open fun setProperty(name: String, value: Any): Unit
Set the given property on the underlying Properties object. |
|
open fun withProperty(name: String, value: Any): MockPropertySource
Convenient synonym for |