Package com.google.javascript.jscomp.testing

# Class TestErrorReporter

java.lang.Object
junit.framework.Assert
com.google.javascript.jscomp.testing.TestErrorReporter

All Implemented Interfaces:
  `com.google.javascript.rhino.head.ErrorReporter`

public final class TestErrorReporter extends junit.framework.Assert implements com.google.javascript.rhino.head.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
Constructor
Description
`TestErrorReporter(String[] errors, String[] warnings)`

## Method Summary

Modifier and Type
Method
Description
`void`
`error(String message, String sourceName, int line, String lineSource, int lineOffset)`
`boolean`
`hasEncounteredAllErrors()`
Returns whether all errors were reported to this reporter.
`boolean`
`hasEncounteredAllWarnings()`
Returns whether all warnings were reported to this reporter.
`com.google.javascript.rhino.head.EvaluatorException`
`runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset)`
`void`
`warning(String message, String sourceName, int line, String lineSource, int lineOffset)`

### 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 Details

### TestErrorReporter

public TestErrorReporter(String[] errors, String[] warnings)

## Method Details

### error

public void error(String message, String sourceName, int line, String lineSource, int lineOffset)

Specified by:
  `error` in interface `com.google.javascript.rhino.head.ErrorReporter`

### warning

public void warning(String message, String sourceName, int line, String lineSource, int lineOffset)

Specified by:
  `warning` in interface `com.google.javascript.rhino.head.ErrorReporter`

### runtimeError

public com.google.javascript.rhino.head.EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset)

Specified by:
  `runtimeError` in interface `com.google.javascript.rhino.head.ErrorReporter`

### 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.