|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
com.google.javascript.rhino.testing.TestErrorReporter
public final class TestErrorReporter
An error reporter for testing that verifies that messages reported to the reporter are expected.
Sample use
TestErrorReporter e = new TestErrorReporter(null, new String[] { "first warning" }); ... assertTrue(e.hasEncounteredAllWarnings());
Constructor Summary | |
---|---|
TestErrorReporter(String[] errors,
String[] warnings)
|
Method Summary | |
---|---|
void |
error(String message,
String sourceName,
int line,
int lineOffset)
Report an error. |
static TestErrorReporter |
forNoExpectedReports()
|
boolean |
hasEncounteredAllErrors()
Returns whether all errors were reported to this reporter. |
boolean |
hasEncounteredAllWarnings()
Returns whether all warnings were reported to this reporter. |
void |
setErrors(String[] errors)
|
void |
setWarnings(String[] warnings)
|
void |
warning(String message,
String sourceName,
int line,
int lineOffset)
Report a warning. |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestErrorReporter(String[] errors, String[] warnings)
Method Detail |
---|
public static TestErrorReporter forNoExpectedReports()
public void setErrors(String[] errors)
public void setWarnings(String[] warnings)
public void error(String message, String sourceName, int line, int lineOffset)
ErrorReporter
error
in interface ErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occurred; typically a filename or URLline
- the line number associated with the errorlineOffset
- the offset into lineSource where problem was detectedpublic void warning(String message, String sourceName, int line, int lineOffset)
ErrorReporter
warning
in interface ErrorReporter
message
- a String describing the warningsourceName
- a String describing the JavaScript source
where the warning occurred; typically a filename or URLline
- the line number associated with the warninglineOffset
- the offset into lineSource where problem was detectedpublic boolean hasEncounteredAllWarnings()
public boolean hasEncounteredAllErrors()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |