Package org.javalite.test
Class SystemStreamUtil
java.lang.Object
org.javalite.test.SystemStreamUtil
This class can be used to catch standard and error outputs in tests so as not to
pollute test printout with "good" exceptions stack traces.
- Author:
- Igor Polevoy: 3/5/12 12:25 PM
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns buffer accumulated with data as string.static String
Returns buffer accumulated with data as string.static void
ReplacesSystem.err
with internal buffer.static void
ReplacesSystem.out
with internal buffer.static void
RestoresSystem.err
to former glory.static void
RestoresSystem.out
to former glory.
-
Method Details
-
replaceOut
public static void replaceOut()ReplacesSystem.out
with internal buffer. All calls such asSystem.out.print...
will go to this buffer and not to STDIO -
getSystemOut
Returns buffer accumulated with data as string.- Returns:
- buffer accumulated with data as string.
-
restoreSystemOut
public static void restoreSystemOut()RestoresSystem.out
to former glory. -
replaceError
public static void replaceError()ReplacesSystem.err
with internal buffer. All calls such asSystem.err.print...
will go to this buffer and not to STDERR -
getSystemErr
Returns buffer accumulated with data as string.- Returns:
- buffer accumulated with data as string.
-
restoreSystemErr
public static void restoreSystemErr()RestoresSystem.err
to former glory.
-