org.netbeans.jemmy
Class TestOut

java.lang.Object
  extended by org.netbeans.jemmy.TestOut

public class TestOut
extends Object

Test output.

Author:
Alexandre Iline (alexandre.iline@sun.com)

Constructor Summary
TestOut()
          Creates unstance using System.in, System.out and System.err streams.
TestOut(InputStream in, PrintStream out, PrintStream err)
          Constructor.
TestOut(InputStream in, PrintStream out, PrintStream err, PrintStream golden)
          Constructor.
TestOut(InputStream in, PrintWriter out, PrintWriter err)
          Constructor.
TestOut(InputStream in, PrintWriter out, PrintWriter err, PrintWriter golden)
          Constructor.
 
Method Summary
 TestOut createErrorOutput()
          Creates an output which prints only error messages.
 void flush()
          Flushes all output threads.
 boolean getAutoFlushMode()
          Says if flush is invoked after each output.
 PrintWriter getErrput()
          Returns errput writer.
 PrintWriter getGolden()
          Returns golden output writer.
 InputStream getInput()
          Returns input stream.
static TestOut getNullOutput()
          Creates output which does not print any message anywhere.
 PrintWriter getOutput()
          Returns output writer.
 void print(String line)
          Prints a line into output.
 void printErrLine(String line)
          Prints a line into error output.
 void printError(String text)
          Prints a error line.
 void printGolden(String line)
          Prints a line into golden output.
 void printLine(boolean toOut, String line)
          Prints a line into either output or errput.
 void printLine(String line)
          Prints a line and then terminate the line by writing the line separator string.
 void printStackTrace(Throwable e)
          Prints an exception stack trace into error stream.
 void printTrace(String text)
          Prints a trace line.
 int read()
          Read one byte from input.
 String readLine()
          Read a line from input.
 boolean setAutoFlushMode(boolean autoFlushMode)
          Specifies either flush is invoked after each output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestOut

public TestOut(InputStream in,
               PrintStream out,
               PrintStream err)
Constructor.

Parameters:
in - Input stream
out - Output stream
err - Errput stream

TestOut

public TestOut(InputStream in,
               PrintStream out,
               PrintStream err,
               PrintStream golden)
Constructor.

Parameters:
in - Input stream
out - Output stream
err - Errput stream
golden - Golgen output stream

TestOut

public TestOut(InputStream in,
               PrintWriter out,
               PrintWriter err)
Constructor.

Parameters:
in - Input stream
out - Output stream
err - Errput stream

TestOut

public TestOut(InputStream in,
               PrintWriter out,
               PrintWriter err,
               PrintWriter golden)
Constructor.

Parameters:
in - Input stream
out - Output stream
err - Errput stream
golden - Golgen output stream

TestOut

public TestOut()
Creates unstance using System.in, System.out and System.err streams.

Method Detail

getNullOutput

public static TestOut getNullOutput()
Creates output which does not print any message anywhere.

Returns:
a TestOut object which does not print any message anywhere.

setAutoFlushMode

public boolean setAutoFlushMode(boolean autoFlushMode)
Specifies either flush is invoked after each output.

Parameters:
autoFlushMode - If true flush is invoking after each output.
Returns:
Old value of the auto flush mode.
See Also:
getAutoFlushMode()

getAutoFlushMode

public boolean getAutoFlushMode()
Says if flush is invoked after each output.

Returns:
Value of the auto flush mode.
See Also:
setAutoFlushMode(boolean)

read

public int read()
         throws IOException
Read one byte from input.

Returns:
an int from input stream.
Throws:
IOException

readLine

public String readLine()
                throws IOException
Read a line from input.

Returns:
a line from input stream.
Throws:
IOException

print

public void print(String line)
Prints a line into output.

Parameters:
line - a string to print into output stream.

printLine

public void printLine(String line)
Prints a line and then terminate the line by writing the line separator string.

Parameters:
line - a string to print into output stream.

printGolden

public void printGolden(String line)
Prints a line into golden output.

Parameters:
line - a string to print into golden output stream.

printErrLine

public void printErrLine(String line)
Prints a line into error output.

Parameters:
line - a string to print into error output stream.

printLine

public void printLine(boolean toOut,
                      String line)
Prints a line into either output or errput.

Parameters:
toOut - If true prints a line into output.
line - a string to print.

printTrace

public void printTrace(String text)
Prints a trace line.

Parameters:
text - a trace text.

printError

public void printError(String text)
Prints a error line.

Parameters:
text - a error text.

printStackTrace

public void printStackTrace(Throwable e)
Prints an exception stack trace into error stream.

Parameters:
e - exception

getInput

public InputStream getInput()
Returns input stream.

Returns:
an input stream

getOutput

public PrintWriter getOutput()
Returns output writer.

Returns:
an output stream

getErrput

public PrintWriter getErrput()
Returns errput writer.

Returns:
a error stream

getGolden

public PrintWriter getGolden()
Returns golden output writer.

Returns:
a golden output stream

createErrorOutput

public TestOut createErrorOutput()
Creates an output which prints only error messages.

Returns:
a TestOut instance which has only error stream.

flush

public void flush()
Flushes all output threads.