org.eclipse.xtext.junit4.validation.AssertableDiagnostics.DiagnosticPredicate Java Examples

The following examples show how to use org.eclipse.xtext.junit4.validation.AssertableDiagnostics.DiagnosticPredicate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: STextValidatorTest.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void checkImportExists() {
	String importName = "does.not.exist";
	Scope context = (Scope) parseExpression("import: \"" + importName + "\"", ImportScope.class.getSimpleName());
	AssertableDiagnostics validationResult = tester.validate(context);
	DiagnosticPredicate predicate_IMPORT_NOT_RESOLVED_MSG = errorMsg(String.format(STextValidationMessages.IMPORT_NOT_RESOLVED_MSG, importName));
	validationResult.assertAll(predicate_IMPORT_NOT_RESOLVED_MSG);
}
 
Example #2
Source File: FjAbstractGeneratedValidatorTests.java    From xsemantics with Eclipse Public License 1.0 4 votes vote down vote up
protected void assertAll(AssertableDiagnostics validate,
		DiagnosticPredicate... predicates) {
	System.err.println(utils.diagnosticsToString(validate));
	validate.assertAll(predicates);
}
 
Example #3
Source File: AbstractValidValidationTest.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Checks that there is no occurrence of a diagnostic predicate in a diagnostic list.
 *
 * @param validate
 *          the diagnostic list in which to look for a diagnostic predicate
 * @param predicate
 *          the predicate diagnostic to look for
 */
private void assertNot(final AssertableDiagnostics validate, final DiagnosticPredicate predicate) {
  if (Iterables.any(Iterables.filter(validate.getAllDiagnostics(), AbstractValidationDiagnostic.class), predicate)) {
    fail("Predicate " + predicate.toString() + " found.");
  }
}