public final class TestErrorReporter extends 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());
Constructor and Description |
---|
TestErrorReporter(String[] errors,
String[] warnings) |
Modifier and Type | Method and Description |
---|---|
void |
assertHasEncounteredAllErrors() |
void |
assertHasEncounteredAllWarnings() |
void |
error(String message,
String sourceName,
int line,
int lineOffset)
Report an error.
|
static TestErrorReporter |
forNoExpectedReports() |
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)
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 void assertHasEncounteredAllWarnings()
public void assertHasEncounteredAllErrors()
Copyright © 2009-2015 Google. All Rights Reserved.