Class TestErrorReporter
java.lang.Object
junit.framework.Assert
com.google.javascript.rhino.testing.TestErrorReporter
- All Implemented Interfaces:
ErrorReporter
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReport an error.static TestErrorReporterbooleanReturns whether all errors were reported to this reporter.booleanReturns whether all warnings were reported to this reporter.voidvoidsetWarnings(String[] warnings) voidReport 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
-
Constructor Details
-
TestErrorReporter
-
-
Method Details
-
forNoExpectedReports
-
setErrors
-
setWarnings
-
error
Description copied from interface:ErrorReporterReport an error. The implementing class is free to throw an exception if it desires. If execution has not yet begun, the JavaScript engine is free to find additional errors rather than terminating the translation. It will not execute a script that had errors, however.- Specified by:
errorin interfaceErrorReporter- Parameters:
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 detected
-
warning
Description copied from interface:ErrorReporterReport a warning. The implementing class may choose to ignore the warning if it desires.- Specified by:
warningin interfaceErrorReporter- Parameters:
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 detected
-
hasEncounteredAllWarnings
public boolean hasEncounteredAllWarnings()Returns whether all warnings were reported to this reporter. -
hasEncounteredAllErrors
public boolean hasEncounteredAllErrors()Returns whether all errors were reported to this reporter.
-