use of org.eclipse.xtext.testing.validation.AssertableDiagnostics in project xtext-core by eclipse.
the class DiagnosticTreeIterableTest method testIteratorIsNotConsumed.
@Test
public void testIteratorIsNotConsumed() {
BasicDiagnostic root = new BasicDiagnostic();
root.add(new BasicDiagnostic());
AssertableDiagnostics diagnostics = new AssertableDiagnostics(root);
Iterable<Diagnostic> allDiagnostics = diagnostics.getAllDiagnostics();
Iterator<Diagnostic> first = allDiagnostics.iterator();
while (first.hasNext()) {
first.next();
}
Assert.assertTrue(allDiagnostics.iterator().hasNext());
}
use of org.eclipse.xtext.testing.validation.AssertableDiagnostics in project xtext-core by eclipse.
the class ValidatorTester method diagnose.
public AssertableDiagnostics diagnose() {
if (!validatorCalled)
throw new IllegalStateException("You have to call validator() before you call diagnose()");
validatorCalled = false;
AssertableDiagnostics ad = new AssertableDiagnostics((Diagnostic) validator.setMessageAcceptor(validator).getState().chain);
validator.setMessageAcceptor(validator).getState().chain = new BasicDiagnostic();
return ad;
}
use of org.eclipse.xtext.testing.validation.AssertableDiagnostics in project xtext-core by eclipse.
the class AbstractConcreteSyntaxValidationTest method validate.
protected AssertableDiagnostics validate(EObject obj) {
final BasicDiagnostic dc = new BasicDiagnostic();
getValidator().validateRecursive(obj, new DiagnosticChainAcceptor(dc), new HashMap<Object, Object>());
return new AssertableDiagnostics(dc);
}
Aggregations