org.suiterunner
Class Report

java.lang.Object
  |
  +--org.suiterunner.Report

public class Report
extends java.lang.Object

Class used to send reports to a reporter.

An instance of class Report contains a source, thread, date, name, message, and optional throwable and rerunnable. This class can be subclassed to send more information to a reporter.

Author:
Bill Venners

Constructor Summary
Report(java.lang.Object source, java.lang.String name, java.lang.String message)
          Constructs a new Report with specified source, name, and message.
Report(java.lang.Object source, java.lang.String name, java.lang.String message, Rerunnable rerunnable)
          Constructs a new Report with specified source, name, message, and rerunnable.
Report(java.lang.Object source, java.lang.String name, java.lang.String message, java.lang.Throwable throwable)
          Constructs a new Report with specified source, name, message, and throwable.
Report(java.lang.Object source, java.lang.String name, java.lang.String message, java.lang.Throwable throwable, Rerunnable rerunnable)
          Constructs a new Report with specified source, name, message, throwable, and rerunnable.
Report(java.lang.Object source, java.lang.String name, java.lang.String message, java.lang.Throwable throwable, Rerunnable rerunnable, java.lang.Thread thread, java.util.Date date)
          Constructs a new Report with specified source, name, message, throwable, rerunnable, thread, and date.
 
Method Summary
 java.util.Date getDate()
          Get the Date embedded in this Report.
 java.lang.String getMessage()
          Get a String message.
 java.lang.String getName()
          Get a String name of the entity about which this Report was generated.
 Rerunnable getRerunnable()
          Get a Rerunnable that can be used to rerun the test or other entity reported about by this Report, or null if the test or other entity cannot be rerun.
 java.lang.Object getSource()
          Get the object that generated this report.
 java.lang.Thread getThread()
          Get the Thread about whose activity this Report was generated.
 java.lang.Throwable getThrowable()
          Get a Throwable that indicated the condition reported by this Report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Report

public Report(java.lang.Object source,
              java.lang.String name,
              java.lang.String message)
Constructs a new Report with specified source, name, and message.
Parameters:
source - the object that generated this report. The source object likely represents some kind of conceptual test or suite of tests, such as for example an instance of org.suiterunner.Suite.
name - the name of the entity about which this report was generated.
message - a String message.

Report

public Report(java.lang.Object source,
              java.lang.String name,
              java.lang.String message,
              java.lang.Throwable throwable)
Constructs a new Report with specified source, name, message, and throwable.
Parameters:
source - the object that generated this report. The source object likely represents some kind of conceptual test or suite of tests, such as for example an instance of org.suiterunner.Suite.
name - the name of the entity about which this report was generated.
message - a String message.
throwable - a relevant Throwable. For example, this Throwable may have indicated a problem being reported by this Report, or it may have been created to provide stack trace information in the Report.

Report

public Report(java.lang.Object source,
              java.lang.String name,
              java.lang.String message,
              Rerunnable rerunnable)
Constructs a new Report with specified source, name, message, and rerunnable.
Parameters:
source - the object that generated this report. The source object likely represents some kind of conceptual test or suite of tests, such as for example an instance of org.suiterunner.Suite.
name - the name of the entity about which this report was generated.
message - a String message.
rerunnable - a Rerunnable that can be used to rerun a test.
Throws:
NullPointerException - if any of the specified source, name, message, or rerunnable parameters are null.

Report

public Report(java.lang.Object source,
              java.lang.String name,
              java.lang.String message,
              java.lang.Throwable throwable,
              Rerunnable rerunnable)
Constructs a new Report with specified source, name, message, throwable, and rerunnable.
Parameters:
source - the object that generated this report. The source object likely represents some kind of conceptual test or suite of tests, such as for example an instance of org.suiterunner.Suite.
name - the name of the entity about which this report was generated.
message - a String message.
throwable - a relevant Throwable. For example, this Throwable may have indicated a problem being reported by this Report, or it may have been created to provide stack trace information in the Report.
rerunnable - a Rerunnable that can be used to rerun a test.
Throws:
NullPointerException - if any of the specified source, name, message, throwable, or rerunnable parameters are null.

Report

public Report(java.lang.Object source,
              java.lang.String name,
              java.lang.String message,
              java.lang.Throwable throwable,
              Rerunnable rerunnable,
              java.lang.Thread thread,
              java.util.Date date)
Constructs a new Report with specified source, name, message, throwable, rerunnable, thread, and date.
Parameters:
source - the object that generated this report. The source object likely represents some kind of conceptual test or suite of tests, such as for example an instance of org.suiterunner.Suite.
name - the name of the entity about which this report was generated.
message - a String message.
throwable - the Throwable that indicated the problem, or a Throwable created to capture stack trace information about the problem, or null. If null is passed, the problem is reported without describing a Throwable and no exception is thrown by this constructor.
rerunnable - a Rerunnable that can be used to rerun a test (usually a failed test), or null. If null is passed, the test can not be rerun and no exception is thrown by this constructor.
thread - the Thread about whose activity this report was generated.
date - a relevant Date. For example, the a Date indicating the time this Report was generated, or a Date indicating the time the event reported by this Report occurred.
Throws:
NullPointerException - if any of the specified source, name, message, thread, or date references are null. (Note that null references are allowed in the throwable and rerunnable parameters.)
Method Detail

getSource

public java.lang.Object getSource()
Get the object that generated this report.
Returns:
the Object that generated this Report. This method will never return null.

getName

public java.lang.String getName()
Get a String name of the entity about which this Report was generated.
Returns:
the name of the entity about this Report was generated. This method will never return null.

getMessage

public java.lang.String getMessage()
Get a String message.
Returns:
a message. This method will never return null.

getThrowable

public java.lang.Throwable getThrowable()
Get a Throwable that indicated the condition reported by this Report. If the condition reported by this Report was not indicated by a Throwable, this method returns null.
Returns:
a Throwable that indicated the condition reported by this Report, or null.

getRerunnable

public Rerunnable getRerunnable()
Get a Rerunnable that can be used to rerun the test or other entity reported about by this Report, or null if the test or other entity cannot be rerun. Invoking rerun on the returned Rerunnable reruns the test. Results will be reported to the Reporter passed to the rerun method.
Returns:
a Rerunnable that can be used to rerun a test, or null.

getThread

public java.lang.Thread getThread()
Get the Thread about whose activity this Report was generated. Often, the Thread returned will be the Thread that "fired" this Report, i.e., the Thread that created this Report and passed it to a Reporter. Nevertheless, the Threada returned need not always be the firing Thread. Thread A, for example, may wish to report on the activity of a Thread B. Thread A can pass Thread B to the Report constructor. Although Thread A is in this case the firing Thread, the getThread method will return Thread B.
Returns:
the Thread about whose activity this Report was generated. This method will never return null.

getDate

public java.util.Date getDate()
Get the Date embedded in this Report. Often, this Date will represent the time at which the Report was created, but may also legally represent any other application-specific timestamp.
Returns:
the Date embedded in this Report. This method will never return null.


Copyright (C) 2001-2003 Artima Software, Inc. All rights reserved.