类 MockPropertySource

java.lang.Object
cn.taketoday.core.env.PropertySource<T>
cn.taketoday.core.env.EnumerablePropertySource<Map<String,Object>>
cn.taketoday.core.env.MapPropertySource
cn.taketoday.core.env.PropertiesPropertySource
cn.taketoday.mock.env.MockPropertySource

public class MockPropertySource extends cn.taketoday.core.env.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(java.lang.String, java.lang.Object) and withProperty(java.lang.String, java.lang.Object) methods are exposed for convenience, for example:
 
   PropertySource<?> source = new MockPropertySource().withProperty("foo", "bar");
 
 
从以下版本开始:
4.0
作者:
Chris Beams
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • MockPropertySource

      public MockPropertySource()
      Create a new MockPropertySource named "mockProperties" that will maintain its own internal Properties instance.
    • MockPropertySource

      public MockPropertySource(String name)
      Create a new MockPropertySource with the given name that will maintain its own internal Properties instance.
      参数:
      name - the name of the property source
    • MockPropertySource

      public MockPropertySource(Properties properties)
      Create a new MockPropertySource named "mockProperties" and backed by the given Properties object.
      参数:
      properties - the properties to use
    • MockPropertySource

      public MockPropertySource(String name, Properties properties)
      Create a new MockPropertySource with the given name and backed by the given Properties object.
      参数:
      name - the name of the property source
      properties - the properties to use
  • 方法详细资料