public interface CapturedOutput
extends java.lang.CharSequence
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
OutputCaptureExtension| Modifier and Type | Method and Description |
|---|---|
default char |
charAt(int index) |
java.lang.String |
getAll()
Return all content (both
System.out and System.err) in the order that it was captured. |
java.lang.String |
getErr()
Return
System.err content in the order that it was captured. |
java.lang.String |
getOut()
Return
System.out content in the order that it was captured. |
default int |
length() |
default java.lang.CharSequence |
subSequence(int start,
int end) |
default int length()
length in interface java.lang.CharSequencedefault char charAt(int index)
charAt in interface java.lang.CharSequencedefault java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencejava.lang.String getAll()
System.out and System.err) in the order that it was captured.java.lang.String getOut()
System.out content in the order that it was captured.System.out captured outputjava.lang.String getErr()
System.err content in the order that it was captured.System.err captured output