public void testValidate() throws Exception {
JavascriptValidator validator = new JavascriptValidator();
List<JavascriptProcessingError> errors = validator.validate("input.js", "var index = 1;\nindex++\nindex += 4;",
false, false);
assertEquals(1, errors.size());
ValidationError error = errors.get(0);
assertEquals("input.js", error.getFilename());
assertEquals(2, error.getLine());
assertEquals(8, error.getStartColumn());
assertEquals("jslint", error.getValidatingTool());
assertEquals("Expected ';' and instead saw 'index'", error.getMessage());
assertEquals("index++", error.getEvidence());
assertEquals(Level.Error, error.getLevel());
assertNull(error.getRule());
// can rerun on the same validator
errors = validator.validate("input2.js", "var i = 1\ni++\n;", false, false);
assertEquals(1, errors.size());
assertEquals("input2.js", errors.get(0).getFilename());