クラス OutputCaptureRule
java.lang.ObjectSE
org.springframework.boot.test.system.OutputCaptureRule
- 実装されたすべてのインターフェース:
CharSequenceSE
、org.junit.rules.TestRule
、CapturedOutput
System.out
および System.err
からの出力をキャプチャーするための JUnit @Rule
。add を @Rule
として使用するには:
public class MyTest { @Rule public OutputCaptureRule output = new OutputCaptureRule(); @Test public void test() { assertThat(output).contains("ok"); } }
- 導入:
- 2.2.0
- 作成者:
- Phillip Webb, Andy Wilkinson
コンストラクターのサマリー
メソッドのサマリー
修飾子と型メソッド説明org.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) void
出力が提供されたmatcher
と一致することを確認します。getAll()
すべてのコンテンツ(System.out
SE およびSystem.err
SE の両方)がキャプチャーされた順序で返されます。getErr()
System.err
SE コンテンツをキャプチャーした順に返します。getOut()
System.out
SE コンテンツをキャプチャーした順に返します。toString()
クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
インターフェース org.springframework.boot.test.system.CapturedOutput から継承されたメソッド
charAt, length, subSequence
インターフェース java.lang.CharSequenceSE から継承されたメソッド
chars, codePoints, isEmpty
コンストラクターの詳細
OutputCaptureRule
public OutputCaptureRule()
メソッドの詳細
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - 次で指定:
- インターフェース
org.junit.rules.TestRule
のapply
getAll
インターフェースからコピーされた説明:CapturedOutput
すべてのコンテンツ(System.out
SE およびSystem.err
SE の両方)がキャプチャーされた順序で返されます。- 次で指定:
- インターフェース
CapturedOutput
のgetAll
- 戻り値:
- キャプチャーされたすべての出力
getOut
インターフェースからコピーされた説明:CapturedOutput
System.out
SE コンテンツをキャプチャーした順に返します。- 次で指定:
- インターフェース
CapturedOutput
のgetOut
- 戻り値:
System.out
SE キャプチャー出力
getErr
インターフェースからコピーされた説明:CapturedOutput
System.err
SE コンテンツをキャプチャーした順に返します。- 次で指定:
- インターフェース
CapturedOutput
のgetErr
- 戻り値:
System.err
SE キャプチャー出力
toString
- 次で指定:
- インターフェース
CharSequenceSE
のtoString
- オーバーライド:
- クラス
ObjectSE
のtoString
expect
出力が提供されたmatcher
と一致することを確認します。検証は、テストメソッドの実行後に実行されます。- パラメーター:
matcher
- マッチャー