インターフェース CapturedOutput
- すべてのスーパーインターフェース:
CharSequenceSE
- すべての既知の実装クラス:
OutputCaptureRule
OutputCaptureExtension
または OutputCaptureRule
によってキャプチャーされた System.out
SE および System.err
SE 出力へのアクセスを提供します。AssertJ または標準の JUnit アサーションを使用してアサーションを適用するために使用できます。例:assertThat(output).contains("started"); // Checks all output assertThat(output.getErr()).contains("failed"); // Only checks System.err assertThat(output.getOut()).contains("ok"); // Only checks System.out
- 導入:
- 2.2.0
- 作成者:
- Madhura Bhave, Phillip Webb, Andy Wilkinson
- 関連事項:
メソッドのサマリー
修飾子と型メソッド説明default char
charAt
(int index) getAll()
すべてのコンテンツ(System.out
SE およびSystem.err
SE の両方)がキャプチャーされた順序で返されます。getErr()
System.err
SE コンテンツをキャプチャーした順に返します。getOut()
System.out
SE コンテンツをキャプチャーした順に返します。default int
length()
default CharSequenceSE
subSequence
(int start, int end) インターフェース java.lang.CharSequenceSE から継承されたメソッド
chars, codePoints, isEmpty, toString
メソッドの詳細
length
default int length()- 次で指定:
- インターフェース
CharSequenceSE
のlength
charAt
default char charAt(int index) - 次で指定:
- インターフェース
CharSequenceSE
のcharAtSE
subSequence
- 次で指定:
- インターフェース
CharSequenceSE
のsubSequenceSE
getAll
StringSE getAll()すべてのコンテンツ(System.out
SE およびSystem.err
SE の両方)がキャプチャーされた順序で返されます。- 戻り値:
- キャプチャーされたすべての出力
getOut
StringSE getOut()System.out
SE コンテンツをキャプチャーした順に返します。- 戻り値:
System.out
SE キャプチャー出力
getErr
StringSE getErr()System.err
SE コンテンツをキャプチャーした順に返します。- 戻り値:
System.err
SE キャプチャー出力