use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testManyOneDup.
@SuppressWarnings("deprecation")
@Test
public void testManyOneDup() {
List<ENamedElement> elements = new ArrayList<>();
for (int i = 0; i < MANY; i++) {
EClass c = createEClass();
if (i == MANY - 1) {
c.setName("i1234");
} else {
c.setName("i" + i);
}
elements.add(c);
}
maxCallCount = 0;
expected.add(elements.get(1_234));
expected.add(elements.get(MANY - 1));
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_03_context.
@Test
public void testCreatedErrors_03_context() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEClass(), createEDataType(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.addAll(elements.subList(0, 2));
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_04.
@SuppressWarnings("deprecation")
@Test
public void testCreatedErrors_04() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEClass(), createEDataType(), createEPackage(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.addAll(elements);
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_07.
@SuppressWarnings("deprecation")
@Test
public void testCreatedErrors_07() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEPackage(), createEDataType(), EcoreFactory.eINSTANCE.createEEnumLiteral());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.add(elements.get(0));
expected.add(elements.get(2));
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_03.
@SuppressWarnings("deprecation")
@Test
public void testCreatedErrors_03() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEClass(), createEDataType(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.addAll(elements.subList(0, 2));
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
Aggregations