use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JsValidator method validate.
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE || !shouldValidate((IFile) resource))
return null;
ValidationResult result = new ValidationResult();
IReporter reporter = result.getReporter(monitor);
IFile file = (IFile) resource;
validateFile(file, reporter);
result.setDependsOn(createDependencies(file));
return result;
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSONSyntaxValidatorHelperTest method missingEndObjectAndBadObjectKey.
@Test
@Ignore
public void missingEndObjectAndBadObjectKey() throws Exception {
IReporter reporter = validate("{aa");
List messages = reporter.getMessages();
Assert.assertEquals(2, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Expected object key but found undefined", 1, 1);
msg = (LocalizedMessage) messages.get(1);
assertMessage(msg, "Missing end object", 1, 1);
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSONSyntaxValidatorHelperTest method badObjectKey.
@Test
@Ignore
public void badObjectKey() throws Exception {
IReporter reporter = validate("{aa}");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Expected object key but found undefined", 1, 1);
// msg = (LocalizedMessage) messages.get(1);
// assertMessage(msg, "Unexpected token", 1, 1);
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSONSyntaxValidatorHelperTest method noErrorsWithArray.
@Test
public void noErrorsWithArray() throws Exception {
IReporter reporter = validate("[]");
List messages = reporter.getMessages();
Assert.assertEquals(0, messages.size());
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSONSyntaxValidatorHelperTest method unexpectedColonInArray.
@Test
public void unexpectedColonInArray() throws Exception {
IReporter reporter = validate("[\"a\":]");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Unexpected token", 1, 1);
}
Aggregations