com.google.javascript.jscomp.testing
Class TestErrorReporter

java.lang.Object
  extended by junit.framework.Assert
      extended by 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
TestErrorReporter(String[] errors, String[] warnings)
           
 
Method Summary
 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 Detail

TestErrorReporter

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

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.