Class TestResult.Section

java.lang.Object
com.sun.javatest.TestResult.Section
Enclosing class:
TestResult

public class TestResult.Section extends 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.
  • Constructor Details

    • Section

      public Section(String title)
  • Method Details

    • 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

      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:
    • getTitle

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

      public 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 PrintWriter createOutput(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 String getOutput(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 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:
    • deleteOutputData

      public void deleteOutputData(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