- java.lang.Object
-
- java.io.OutputStream
-
- org.junitpioneer.jupiter.StdOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.ByteArrayOutputStreamout
-
Constructor Summary
Constructors Constructor Description StdOutputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]capturedLines()ThecapturedString(), divided on the line separator.java.lang.StringcapturedString()voidwrite(byte[] b, int off, int len)voidwrite(int i)
-
-
-
Method Detail
-
write
public void write(int i)
- Specified by:
writein classjava.io.OutputStream
-
write
public final void write(byte[] b, int off, int len)- Overrides:
writein classjava.io.OutputStream
-
capturedString
public java.lang.String capturedString()
- Returns:
- the string that was written to
System.outorSystem.err
-
capturedLines
public java.lang.String[] capturedLines()
ThecapturedString(), divided on the line separator.This includes leading, inner, and trailing empty lines but does not include the potential empty string that comes after a trailing line separator. (The exact algorithm is based on but behaves differently from
String.split(String).)Because the return value does not include a trailing empty line that comes from a trailing line separator, it can't be used to distinguish the cases where the last line was created by a
printor aprintln. For more details and examples on this, see the documentation on standard input/output.- Returns:
- the lines that were written to
System.outorSystem.err
-
-