接口 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 char
charAt
(int index) getAll()
Return all content (bothSystem.out
andSystem.err
) in the order that it was captured.getErr()
ReturnSystem.err
content in the order that it was captured.getOut()
ReturnSystem.out
content in the order that it was captured.default int
length()
default CharSequence
subSequence
(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.out
andSystem.err
) in the order that it was captured.- 返回:
- all captured output
-
getOut
String getOut()ReturnSystem.out
content in the order that it was captured.- 返回:
System.out
captured output
-
getErr
String getErr()ReturnSystem.err
content in the order that it was captured.- 返回:
System.err
captured output
-