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

java.lang.Object
  |
  +--junit.framework.TestResult
        |
        +--edu.rice.cs.drjava.model.junit.JUnitError
All Implemented Interfaces:
Comparable, Serializable

public class JUnitError
extends TestResult
implements Comparable, Serializable

A class to represent JUnit errors. Having this class allows DrJava to make the errors as legible as possible.

Version:
$Id: JUnitError.java,v 1.4 2002/08/15 23:03:57 jhsia Exp $
See Also:
Serialized Form

Field Summary
private  String _fileName
           
private  boolean _isError
           
private  int _lineNumber
          zero-based line number.
private  String _message
           
private  String _stackTrace
           
private  int _startColumn
          zero-based column number.
private  String _test
           
 
Fields inherited from class junit.framework.TestResult
fErrors, fFailures, fListeners, fRunTests, fStop
 
Constructor Summary
JUnitError(String fileName, int lineNumber, int startColumn, String message, boolean isError, String test, String stackTrace)
          Constructor.
 
Method Summary
private  int compareByPosition(JUnitError other)
          Compares this error with the given one, based first on line number, and then by column.
 int compareTo(Object o)
          Compares by file, then by line, then by column.
 String fileName()
          Gets the full name of the file.
 boolean isWarning()
          Determines if the error is a warning.
 int lineNumber()
          Gets the line number of the error.
 String message()
          Gets the error message.
 String stackTrace()
           
 int startColumn()
          Gets the column where the error begins.
 String testName()
          Gets the test name
 String toString()
          Gets a String representation of the error.
 
Methods inherited from class junit.framework.TestResult
addError, addFailure, addListener, cloneListeners, endTest, errorCount, errors, failureCount, failures, removeListener, run, runCount, runProtected, runTests, shouldStop, startTest, stop, testErrors, testFailures, wasSuccessful
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

_fileName

private String _fileName

_lineNumber

private int _lineNumber
zero-based line number.

_startColumn

private int _startColumn
zero-based column number.

_message

private String _message

_test

private String _test

_isError

private boolean _isError

_stackTrace

private String _stackTrace
Constructor Detail

JUnitError

public JUnitError(String fileName,
                  int lineNumber,
                  int startColumn,
                  String message,
                  boolean isError,
                  String test,
                  String stackTrace)
Constructor.
Parameters:
File - file the file where the error occurred
int - lineNumber the line number of the error
int - startColumn the starting column of the error
String - message the error message
boolean - isError true if the error is a warning
Method Detail

toString

public String toString()
Gets a String representation of the error.
Overrides:
toString in class Object
Returns:
the error as a String

fileName

public String fileName()
Gets the full name of the file.
Returns:
the file name.

lineNumber

public int lineNumber()
Gets the line number of the error.
Returns:
the line number

startColumn

public int startColumn()
Gets the column where the error begins.
Returns:
the starting column

message

public String message()
Gets the error message.
Returns:
the error message.

testName

public String testName()
Gets the test name
Returns:
the test name

stackTrace

public String stackTrace()

isWarning

public boolean isWarning()
Determines if the error is a warning.
Returns:
true if the error is a warning.

compareTo

public int compareTo(Object o)
Compares by file, then by line, then by column. Errors without files are considered equal, but less than any errors with files.
Specified by:
compareTo in interface Comparable

compareByPosition

private int compareByPosition(JUnitError other)
Compares this error with the given one, based first on line number, and then by column.