接口 CapturedOutput
- 所有超级接口:
CharSequence
- 所有已知实现类:
OutputCaptureRule
Provides access to
System.out and System.err
output that has been captured by the OutputCaptureExtension or
OutputCaptureRule. Can be used to apply assertions either using AssertJ or
standard JUnit assertions. For example:
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 charcharAt(int index) getAll()Return all content (bothSystem.outandSystem.err) in the order that it was captured.getErr()ReturnSystem.errcontent in the order that it was captured.getOut()ReturnSystem.outcontent in the order that it was captured.default intlength()default CharSequencesubSequence(int start, int end) 从接口继承的方法 java.lang.CharSequence
chars, codePoints, isEmpty, toString
-
方法详细资料
-
length
default int length()- 指定者:
length在接口中CharSequence
-
charAt
default char charAt(int index) - 指定者:
charAt在接口中CharSequence
-
subSequence
- 指定者:
subSequence在接口中CharSequence
-
getAll
String getAll()Return all content (bothSystem.outandSystem.err) in the order that it was captured.- 返回:
- all captured output
-
getOut
String getOut()ReturnSystem.outcontent in the order that it was captured.- 返回:
System.outcaptured output
-
getErr
String getErr()ReturnSystem.errcontent in the order that it was captured.- 返回:
System.errcaptured output
-