Interface CapturedOutput
- All Superinterfaces:
- CharSequence
- All Known Implementing Classes:
- 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
- Since:
- 2.2.0
- Author:
- Madhura Bhave, Phillip Webb, Andy Wilkinson
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondefault 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) Methods inherited from interface CharSequencechars, codePoints, getChars, isEmpty, toString
- 
Method Details- 
lengthdefault int length()- Specified by:
- lengthin interface- CharSequence
 
- 
charAtdefault char charAt(int index) - Specified by:
- charAtin interface- CharSequence
 
- 
subSequence- Specified by:
- subSequencein interface- CharSequence
 
- 
getAllString getAll()Return all content (bothSystem.outandSystem.err) in the order that it was captured.- Returns:
- all captured output
 
- 
getOutString getOut()ReturnSystem.outcontent in the order that it was captured.- Returns:
- System.outcaptured output
 
- 
getErrString getErr()ReturnSystem.errcontent in the order that it was captured.- Returns:
- System.errcaptured output
 
 
-