public final class TestErrorReporter extends Assert implements 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 and Description |
|---|
TestErrorReporter(String[] errors,
String[] warnings) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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)
ErrorReportererror in interface ErrorReportermessage - 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)
ErrorReporterwarning in interface ErrorReportermessage - 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()
Copyright © 2009-2014 Google. All Rights Reserved.