クラス MockPropertySource
java.lang.ObjectSE
org.springframework.core.env.PropertySource<T>
org.springframework.core.env.EnumerablePropertySource<MapSE<StringSE,ObjectSE>>
org.springframework.core.env.MapPropertySource
org.springframework.core.env.PropertiesPropertySource
org.springframework.mock.env.MockPropertySource
テスト用のシンプルな
PropertySource 実装です。ユーザー指定の PropertiesSE オブジェクトを受け入れます。構築時に省略された場合は、実装が独自に初期化します。setProperty(java.lang.String, java.lang.Object) および withProperty(java.lang.String, java.lang.Object) メソッドは便宜上公開されています。例:
PropertySource<?> source = new MockPropertySource().withProperty("foo", "bar");
- 導入:
- 3.1
- 作成者:
- Chris Beams
- 関連事項:
ネストされたクラスの要約
クラス org.springframework.core.env.PropertySource から継承されたネストクラス / インターフェース
PropertySource.StubPropertySourceフィールドのサマリー
フィールド修飾子と型フィールド説明static final StringSE"mockProperties" は、明示的に名前が指定されていない場合のMockPropertySourceインスタンスのデフォルト名です。クラス org.springframework.core.env.PropertySource から継承されたフィールド
logger, name, sourceコンストラクターの概要
コンストラクターコンストラクター説明MockPropertySource(StringSE name) 独自の内部PropertiesSE インスタンスを維持する、指定された名前で新しいMockPropertySourceを作成します。MockPropertySource(StringSE name, PropertiesSE properties) 指定された名前で、指定されたPropertiesSE オブジェクトによる新しいMockPropertySourceを作成します。MockPropertySource(PropertiesSE properties) メソッドのサマリー
修飾子と型メソッド説明voidsetProperty(StringSE name, ObjectSE value) 基になるPropertiesSE オブジェクトに指定されたプロパティを設定します。withProperty(StringSE name, ObjectSE value) 現在のインスタンスを返すsetProperty(java.lang.String, java.lang.Object)の便利なシノニム。クラス org.springframework.core.env.PropertiesPropertySource から継承されたメソッド
getPropertyNamesクラス org.springframework.core.env.MapPropertySource から継承されたメソッド
containsProperty, getProperty
フィールドの詳細
MOCK_PROPERTIES_PROPERTY_SOURCE_NAME
"mockProperties" は、明示的に名前が指定されていない場合のMockPropertySourceインスタンスのデフォルト名です。
コンストラクターの詳細
MockPropertySource
public MockPropertySource()MockPropertySource
独自の内部PropertiesSE インスタンスを維持する、指定された名前で新しいMockPropertySourceを作成します。- パラメーター:
name- プロパティソースの名前
MockPropertySource
- パラメーター:
properties- 使用するプロパティ
MockPropertySource
指定された名前で、指定されたPropertiesSE オブジェクトによる新しいMockPropertySourceを作成します。- パラメーター:
name- プロパティソースの名前properties- 使用するプロパティ
メソッドの詳細
setProperty
基になるPropertiesSE オブジェクトに指定されたプロパティを設定します。withProperty
現在のインスタンスを返すsetProperty(java.lang.String, java.lang.Object)の便利なシノニム。メソッドの連鎖や Fluent スタイルの使用に役立ちます。
- 戻り値:
- この
MockPropertySourceインスタンス