use of org.eclipse.xtext.ui.editor.reconciler.ReconcilerReplaceRegion in project xtext-eclipse by eclipse.
the class Bug297909Test method testReconcileDocument.
@Test
public void testReconcileDocument() throws Exception {
Injector injector = doGetSetup().createInjectorAndDoEMFRegistration();
XtextDocument document = injector.getInstance(XtextDocument.class);
document.setValidationJob(new Job("Job") {
@Override
protected IStatus run(IProgressMonitor monitor) {
return Status.OK_STATUS;
}
});
XtextResource resource = injector.getInstance(XtextResource.class);
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.getResources().add(resource);
resource.load(new StringInputStream(""), Collections.singletonMap(XtextResource.OPTION_ENCODING, Charset.defaultCharset().name()));
document.setInput(resource);
document.set("abstract rules firstRule");
XtextDocumentReconcileStrategy strategy = injector.getInstance(XtextDocumentReconcileStrategy.class);
strategy.setDocument(document);
strategy.setResource(resource);
try {
strategy.reconcile(new ReconcilerReplaceRegion(0, document.getLength(), document.get()));
fail("Expected ParseException");
} catch (ParseException expected) {
assertTrue(expected.getMessage().contains("Make sure the EPackage has been registered"));
}
}
Aggregations