Class TestOut


  • public class TestOut
    extends Object
    Test output.
    Author:
    Alexandre Iline (alexandre.iline@sun.com)
    • Constructor Detail

      • 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
      • 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.