org.javalite.test
Class SystemStreamUtil

java.lang.Object
  extended by org.javalite.test.SystemStreamUtil

public class SystemStreamUtil
extends Object

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

Constructor Summary
SystemStreamUtil()
           
 
Method Summary
static String getSystemErr()
          Returns buffer accumulated with data as string.
static String getSystemOut()
          Returns buffer accumulated with data as string.
static void replaceError()
          Replaces System.err with internal buffer.
static void replaceOut()
          Replaces System.out with internal buffer.
static void restoreSystemErr()
          Restores System.err to former glory.
static void restoreSystemOut()
          Restores System.out to former glory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemStreamUtil

public SystemStreamUtil()
Method Detail

replaceOut

public static void replaceOut()
Replaces System.out with internal buffer. All calls such as System.out.print... will go to this buffer and not to STDIO


getSystemOut

public static String getSystemOut()
Returns buffer accumulated with data as string.

Returns:
buffer accumulated with data as string.

restoreSystemOut

public static void restoreSystemOut()
Restores System.out to former glory.


replaceError

public static void replaceError()
Replaces System.err with internal buffer. All calls such as System.err.print... will go to this buffer and not to STDERR


getSystemErr

public static String getSystemErr()
Returns buffer accumulated with data as string.

Returns:
buffer accumulated with data as string.

restoreSystemErr

public static void restoreSystemErr()
Restores System.err to former glory.



Copyright © 2015 JavaLite. All rights reserved.