public interface CapturedOutput extends CharSequence
System.out
and System.err
output that has been captured by the OutputCaptureExtension
. 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.put
OutputCaptureExtension
Modifier and Type | Method and Description |
---|---|
default char |
charAt(int index) |
String |
getAll()
Return all content (both
System.out and System.err ) in the order that it was was captured. |
String |
getErr()
Return
System.err content in the order that it was was captured. |
String |
getOut()
Return
System.out content in the order that it was was captured. |
default int |
length() |
default CharSequence |
subSequence(int start,
int end) |
chars, codePoints, toString
default int length()
length
in interface CharSequence
default char charAt(int index)
charAt
in interface CharSequence
default CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
String getAll()
System.out
and System.err
) in the order that it was was captured.String getOut()
System.out
content in the order that it was was captured.System.out
captured outputString getErr()
System.err
content in the order that it was was captured.System.err
captured outputCopyright © 2019 Pivotal Software, Inc.. All rights reserved.