use of org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport in project xtext-core by eclipse.
the class AbstractCompositeValidatorTest method testFirstAndSecond.
@Test
public void testFirstAndSecond() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
CompositeEValidator composite = (CompositeEValidator) validator;
Collection<EValidatorEqualitySupport> contents = composite.getContents();
EValidatorEqualitySupport equalitySupport = get(EValidatorEqualitySupport.class);
equalitySupport.setDelegate(first);
assertTrue(contents.contains(equalitySupport));
equalitySupport.setDelegate(second);
assertTrue(contents.contains(equalitySupport));
}
use of org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport in project xtext-core by eclipse.
the class CompositeEValidatorTest method testNoShortCircuiting.
/**
* Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=396726
*/
@Test
public void testNoShortCircuiting() {
CompositeEValidator compositeValidator = new CompositeEValidator();
compositeValidator.setEqualitySupportProvider(new Provider<CompositeEValidator.EValidatorEqualitySupport>() {
@Override
public EValidatorEqualitySupport get() {
return new CompositeEValidator.EValidatorEqualitySupport();
}
});
assertEquals(1, compositeValidator.getContents().size());
compositeValidator.addValidator(EcoreValidator.INSTANCE);
assertEquals(2, compositeValidator.getContents().size());
TestEcoreValidator testValidator = new TestEcoreValidator();
compositeValidator.addValidator(testValidator);
assertEquals(3, compositeValidator.getContents().size());
compositeValidator.validate(EcoreFactory.eINSTANCE.createEClass(), new BasicDiagnostic(), null);
assertTrue(testValidator.wasCalled());
}
use of org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport in project xtext-core by eclipse.
the class CompositeValidatorWithEObjectValidatorTest method testContentsSize.
@Override
@Test
public void testContentsSize() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
CompositeEValidator composite = (CompositeEValidator) validator;
Collection<EValidatorEqualitySupport> contents = composite.getContents();
assertEquals(3, contents.size());
}
use of org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport in project xtext-core by eclipse.
the class CompositeValidatorWithoutEObjectValidatorTest method testContentsSize.
@Override
@Test
public void testContentsSize() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
CompositeEValidator composite = (CompositeEValidator) validator;
Collection<EValidatorEqualitySupport> contents = composite.getContents();
assertEquals(2, contents.size());
}
Aggregations