|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
public interface TestContext
S2JUnit4を使ったテストの実行コンテキストを表すインターフェースです。
テストの実行コンテキストはテストケース毎に作成/破棄されます。 実行コンテキストは、以下のように定義するとS2JUnit4の自動フィールドバインディング機能により値が設定されます。
@RunWith(Seasar2.class)
public class HogeTest {
...
private TestContext testContext;
...
}
| メソッドの概要 | ||
|---|---|---|
|
getComponent(java.lang.Class<? extends T> componentKey)
指定されたキーに対応するコンポーネントを返します。 |
|
java.lang.Object |
getComponent(java.lang.Object componentKey)
指定されたキーに対応するコンポーネントを返します。 |
|
ComponentDef |
getComponentDef(int index)
番号で指定された位置のコンポーネント定義を返します。 |
|
ComponentDef |
getComponentDef(java.lang.Object componentKey)
指定されたキーに対応するコンポーネント定義を返します。 |
|
DataSet |
getExpected()
テストの期待値を返します。 |
|
MockInterceptor |
getMockInterceptor(int index)
番号で指定された位置のモックインターセプタを返します。 |
|
int |
getMockInterceptorSize()
登録されたモックインターセプタの数を返します。 |
|
PreparationType |
getPreparationType()
PreparationTypeを返します。 |
|
java.lang.String |
getTestClassPackagePath()
テストクラスのパッケージをパスに変換して返します。 |
|
java.lang.String |
getTestClassShortName()
テストクラスの単純名を返します。 |
|
java.lang.String |
getTestMethodName()
テストメソッドの名称を返します。 |
|
boolean |
hasComponentDef(java.lang.Object componentKey)
指定されたキーに対応するコンポーネント定義が存在する場合 trueを返します。 |
|
void |
include(java.lang.String path)
指定された設定ファイルのパスからS2コンテナを生成し、子コンテナとしてルートのS2コンテナにインクルードします。 |
|
boolean |
isTrimString()
テストデータの文字列に含まれる空白を取り除く場合は trueを返します。 |
|
void |
register(java.lang.Class<?> componentClass)
クラスをコンポーネント定義として登録します。 |
|
void |
register(java.lang.Class<?> componentClass,
java.lang.String componentName)
指定された名前でクラスをコンポーネント定義として登録します。 |
|
void |
register(ComponentDef componentDef)
コンポーネント定義を登録します。 |
|
void |
register(java.lang.Object component)
コンポーネントを登録します。 |
|
void |
register(java.lang.Object component,
java.lang.String componentName)
指定された名前でコンポーネントを登録します。 |
|
void |
setAutoIncluding(boolean autoIncluding)
このコンテキストの初期化時に特定のS2コンテナを子コンテナとしてインクルードする場合は trueを設定します。 |
|
void |
setAutoPreparing(boolean autoPreparing)
推奨されていません。 |
|
void |
setPreparationType(PreparationType preparationType)
PreparationTypeを設定します。 |
|
void |
setTrimString(boolean trimString)
テストデータの文字列に含まれる空白を取り除く場合は trueを設定します。 |
|
| メソッドの詳細 |
|---|
void register(java.lang.Class<?> componentClass)
componentClass - コンポーネントのクラス
void register(java.lang.Class<?> componentClass,
java.lang.String componentName)
componentClass - コンポーネントのクラスcomponentName - コンポーネント名void register(java.lang.Object component)
component - コンポーネント
void register(java.lang.Object component,
java.lang.String componentName)
component - コンポーネントcomponentName - コンポーネント名void register(ComponentDef componentDef)
componentDef - コンポーネント定義void include(java.lang.String path)
path - 設定ファイルのパスvoid setAutoIncluding(boolean autoIncluding)
trueを設定します。
autoIncluding - 自動インクルードをする場合true@Deprecated void setAutoPreparing(boolean autoPreparing)
trueを設定します。
代わりにsetPreparationType(PreparationType)を使用してください。
autoPreparing - 自動でテストデータを準備する場合truevoid setPreparationType(PreparationType preparationType)
PreparationTypeを設定します。
preparationType - PreparationTypePreparationType getPreparationType()
PreparationTypeを返します。
PreparationTypevoid setTrimString(boolean trimString)
trueを設定します。
trimString - テストデータの文字列に含まれる空白を取り除く場合はtrueboolean isTrimString()
trueを返します。
true、そうでない場合は
false<T> T getComponent(java.lang.Class<? extends T> componentKey)
T - コンポーネントの型componentKey - コンポーネントを取得するためのキー
java.lang.Object getComponent(java.lang.Object componentKey)
componentKey - コンポーネントを取得するためのキー
boolean hasComponentDef(java.lang.Object componentKey)
trueを返します。
componentKey - コンポーネントを取得するためのキー
true、そうでない場合は
falseComponentDef getComponentDef(int index)
index - 番号
ComponentDef getComponentDef(java.lang.Object componentKey)
componentKey - コンポーネントを取得するためのキー
DataSet getExpected()
nulljava.lang.String getTestClassPackagePath()
java.lang.String getTestClassShortName()
java.lang.String getTestMethodName()
MockInterceptor getMockInterceptor(int index)
モックインターセプタはMockにより登録されます。
番号は0から始まります。
index - 番号
int getMockInterceptorSize()
モックインターセプタはMockにより登録されます。
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||