Class TestOut


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

      Constructors 
      Constructor Description
      TestOut()
      Creates unstance using System.in, System.out and System.err streams.
      TestOut​(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
      Constructor.
      TestOut​(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err, java.io.PrintStream golden)
      Constructor.
      TestOut​(java.io.InputStream in, java.io.PrintWriter out, java.io.PrintWriter err)
      Constructor.
      TestOut​(java.io.InputStream in, java.io.PrintWriter out, java.io.PrintWriter err, java.io.PrintWriter golden)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      java.io.PrintWriter getErrput()
      Returns errput writer.
      java.io.PrintWriter getGolden()
      Returns golden output writer.
      java.io.InputStream getInput()
      Returns input stream.
      static TestOut getNullOutput()
      Creates output which does not print any message anywhere.
      java.io.PrintWriter getOutput()
      Returns output writer.
      void print​(java.lang.String line)
      Prints a line into output.
      void printErrLine​(java.lang.String line)
      Prints a line into error output.
      void printError​(java.lang.String text)
      Prints a error line.
      void printGolden​(java.lang.String line)
      Prints a line into golden output.
      void printLine​(boolean toOut, java.lang.String line)
      Prints a line into either output or errput.
      void printLine​(java.lang.String line)
      Prints a line and then terminate the line by writing the line separator string.
      void printStackTrace​(java.lang.Throwable e)
      Prints an exception stack trace into error stream.
      void printTrace​(java.lang.String text)
      Prints a trace line.
      int read()
      Read one byte from input.
      java.lang.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​(java.io.InputStream in,
                       java.io.PrintStream out,
                       java.io.PrintStream err)
        Constructor.
        Parameters:
        in - Input stream
        out - Output stream
        err - Errput stream
      • TestOut

        public TestOut​(java.io.InputStream in,
                       java.io.PrintStream out,
                       java.io.PrintStream err,
                       java.io.PrintStream golden)
        Constructor.
        Parameters:
        in - Input stream
        out - Output stream
        err - Errput stream
        golden - Golgen output stream
      • TestOut

        public TestOut​(java.io.InputStream in,
                       java.io.PrintWriter out,
                       java.io.PrintWriter err)
        Constructor.
        Parameters:
        in - Input stream
        out - Output stream
        err - Errput stream
      • TestOut

        public TestOut​(java.io.InputStream in,
                       java.io.PrintWriter out,
                       java.io.PrintWriter err,
                       java.io.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 java.io.IOException
        Read one byte from input.
        Returns:
        an int from input stream.
        Throws:
        java.io.IOException
      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        Read a line from input.
        Returns:
        a line from input stream.
        Throws:
        java.io.IOException
      • print

        public void print​(java.lang.String line)
        Prints a line into output.
        Parameters:
        line - a string to print into output stream.
      • printLine

        public void printLine​(java.lang.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​(java.lang.String line)
        Prints a line into golden output.
        Parameters:
        line - a string to print into golden output stream.
      • printErrLine

        public void printErrLine​(java.lang.String line)
        Prints a line into error output.
        Parameters:
        line - a string to print into error output stream.
      • printLine

        public void printLine​(boolean toOut,
                              java.lang.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​(java.lang.String text)
        Prints a trace line.
        Parameters:
        text - a trace text.
      • printError

        public void printError​(java.lang.String text)
        Prints a error line.
        Parameters:
        text - a error text.
      • printStackTrace

        public void printStackTrace​(java.lang.Throwable e)
        Prints an exception stack trace into error stream.
        Parameters:
        e - exception
      • getInput

        public java.io.InputStream getInput()
        Returns input stream.
        Returns:
        an input stream
      • getOutput

        public java.io.PrintWriter getOutput()
        Returns output writer.
        Returns:
        an output stream
      • getErrput

        public java.io.PrintWriter getErrput()
        Returns errput writer.
        Returns:
        a error stream
      • getGolden

        public java.io.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.