public final class TestErrorReporter extends java.lang.Object 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());
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String[] |
errors |
private int |
errorsIndex |
private java.lang.String[] |
warnings |
private int |
warningsIndex |
| Constructor and Description |
|---|
TestErrorReporter(java.lang.String[] errors,
java.lang.String[] warnings) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertHasEncounteredAllErrors() |
void |
assertHasEncounteredAllWarnings() |
void |
error(java.lang.String message,
java.lang.String sourceName,
int line,
int lineOffset)
Report an error.
|
static TestErrorReporter |
forNoExpectedReports() |
void |
setErrors(java.lang.String[] errors) |
void |
setWarnings(java.lang.String[] warnings) |
void |
warning(java.lang.String message,
java.lang.String sourceName,
int line,
int lineOffset)
Report a warning.
|
private java.lang.String[] errors
private java.lang.String[] warnings
private int errorsIndex
private int warningsIndex
public TestErrorReporter(java.lang.String[] errors,
java.lang.String[] warnings)
public static TestErrorReporter forNoExpectedReports()
public void setErrors(java.lang.String[] errors)
public void setWarnings(java.lang.String[] warnings)
public void error(java.lang.String message,
java.lang.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(java.lang.String message,
java.lang.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 void assertHasEncounteredAllWarnings()
public void assertHasEncounteredAllErrors()