Search in sources :

Example 1 with EValidatorEqualitySupport

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));
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Example 2 with EValidatorEqualitySupport

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());
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Test(org.junit.Test)

Example 3 with EValidatorEqualitySupport

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());
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Example 4 with EValidatorEqualitySupport

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());
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Aggregations

EValidatorEqualitySupport (org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport)4 Test (org.junit.Test)4 EValidator (org.eclipse.emf.ecore.EValidator)3 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)1