edu.rice.cs.drjava.model.junit
Class JUnitError

java.lang.Object
  extended by edu.rice.cs.drjava.model.DJError
      extended by edu.rice.cs.drjava.model.junit.JUnitError
All Implemented Interfaces:
Serializable, Comparable<DJError>

public class JUnitError
extends DJError
implements Serializable

A class to represent JUnit errors. This class enables DrJava to highlight the exact error text.

Version:
$Id: JUnitError.java 5439 2011-08-11 17:13:04Z rcartwright $
See Also:
Serialized Form

Field Summary
private  String _className
           
private  String _exception
           
private  StackTraceElement[] _stackTrace
           
private  String _test
           
 
Constructor Summary
JUnitError(File file, int lineNumber, int startColumn, String message, boolean isWarning, String test, String className, String exception, StackTraceElement[] stackTrace)
          Constructor.
JUnitError(String message, boolean isWarning, String test)
          Constructor for an error with no associated location.
 
Method Summary
 String className()
          Gets the class name
 String exception()
          All JUnit errors are Throwables that have been thrown, so all have a stack trace
 void setStackTrace(StackTraceElement[] stes)
          Set the array of stack trace elements.
 StackTraceElement[] stackTrace()
          Return the array of stack trace elements.
 String testName()
          Gets the test name
 String toString()
          Gets a String representation of the error.
 
Methods inherited from class edu.rice.cs.drjava.model.DJError
compareTo, file, fileName, getFileMessage, getLineMessage, hasNoLocation, isWarning, lineNumber, message, setLineNumber, startColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_test

private volatile String _test

_className

private volatile String _className

_exception

private volatile String _exception

_stackTrace

private volatile StackTraceElement[] _stackTrace
Constructor Detail

JUnitError

public JUnitError(File file,
                  int lineNumber,
                  int startColumn,
                  String message,
                  boolean isWarning,
                  String test,
                  String className,
                  String exception,
                  StackTraceElement[] stackTrace)
Constructor.

Parameters:
file - the file where the error occurred
lineNumber - the line number of the error
startColumn - the starting column of the error
message - the error message
isWarning - true if the error is a warning
test - the name of the test that failed

JUnitError

public JUnitError(String message,
                  boolean isWarning,
                  String test)
Constructor for an error with no associated location. This constructor also provides a default stackTrace.

Parameters:
message - the error message
isWarning - true if the error is a warning
test - the name of the test that failed
Method Detail

testName

public String testName()
Gets the test name

Returns:
the test name

className

public String className()
Gets the class name

Returns:
the class name

exception

public String exception()
All JUnit errors are Throwables that have been thrown, so all have a stack trace

Returns:
the stack trace associated with the error

stackTrace

public StackTraceElement[] stackTrace()
Return the array of stack trace elements.


setStackTrace

public void setStackTrace(StackTraceElement[] stes)
Set the array of stack trace elements.


toString

public String toString()
Description copied from class: DJError
Gets a String representation of the error. Abstract.

Overrides:
toString in class DJError
Returns:
the error as a String