Class TestResult.Section

  • Enclosing class:
    TestResult

    public class TestResult.Section
    extends java.lang.Object
    This "section" is the logical combination of a single action during test execution. It is designed to hold multiple (or none) buffers of output from test execution, such as stdout and stderr. In addition, it has a "comment" field for tracking the test run itself (progress). This output is identified by the MSG_SECTION_NAME identifier.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.PrintWriter createOutput​(java.lang.String name)
      Add a new output buffer to the section; get PrintWriter access to it.
      void deleteOutputData​(java.lang.String name)
      Removes any data added to the named output up to this point, resetting it to an empty state.
      java.io.PrintWriter getMessageWriter()
      Get the appropriate to writer to access the default message field.
      java.lang.String getOutput​(java.lang.String name)
      Get the content that was written to a specified output stream.
      int getOutputCount()
      Find out how many output buffers this section has inside it.
      java.lang.String[] getOutputNames()
      Find out the symbolic names of all the streams in this section.
      Status getStatus()
      Find out what the result of the execution of this section was.
      java.lang.String getTitle()
      Get the title of this section, specified when the section was created.
      boolean isMutable()
      Query if the section is still writable or not.
      void setStatus​(Status result)
      Set the result of this section.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isMutable

        public boolean isMutable()
        Query if the section is still writable or not.
        Returns:
        true if the section is still writable, and false otherwise
      • getStatus

        public Status getStatus()
        Find out what the result of the execution of this section was.
        Returns:
        the result of the execution of this section
        See Also:
        setStatus(com.sun.javatest.Status)
      • setStatus

        public void setStatus​(Status result)
        Set the result of this section. This action makes this section immutable.
        Parameters:
        result - The status to set as the result of this section of the test
        See Also:
        getStatus()
      • getTitle

        public java.lang.String getTitle()
        Get the title of this section, specified when the section was created.
        Returns:
        the title of this section
      • getMessageWriter

        public java.io.PrintWriter getMessageWriter()
        Get the appropriate to writer to access the default message field.
        Returns:
        a Writer to access the default message field
      • getOutputCount

        public int getOutputCount()
        Find out how many output buffers this section has inside it.
        Returns:
        The number of output buffers in use (>=0).
      • createOutput

        public java.io.PrintWriter createOutput​(java.lang.String name)
        Add a new output buffer to the section; get PrintWriter access to it.
        Parameters:
        name - The symbolic name that will identify this new stream.
        Returns:
        A PrintWriter that gives access to the new stream.
      • getOutput

        public java.lang.String getOutput​(java.lang.String name)
        Get the content that was written to a specified output stream.
        Parameters:
        name - the name of the stream in question
        Returns:
        All the data that was written to the specified output, or null if nothing has been written.
      • getOutputNames

        public java.lang.String[] getOutputNames()
        Find out the symbolic names of all the streams in this section. You can use getOutputCount to discover the number of items in this enumeration (not a thread safe activity in the strictest sense of course).
        Returns:
        A list of strings which are the symbolic names of the streams in this section.
        See Also:
        getOutputCount()
      • deleteOutputData

        public void deleteOutputData​(java.lang.String name)
        Removes any data added to the named output up to this point, resetting it to an empty state.
        Parameters:
        name - The output name to erase the content of.
        Since:
        4.2.1