summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhbehrens2008-11-11 06:20:47 (EST)
committer sefftinge2008-11-11 06:20:47 (EST)
commitf34e5b0833b6ba3cf9e5669a430048a76617d2ac (patch)
treea45f153059c37bbb947f0a681412a9e9541527fc
parent42ce9982e6074d42d536dec93419dc815c8f40b0 (diff)
downloadorg.eclipse.xtext-f34e5b0833b6ba3cf9e5669a430048a76617d2ac.zip
org.eclipse.xtext-f34e5b0833b6ba3cf9e5669a430048a76617d2ac.tar.gz
org.eclipse.xtext-f34e5b0833b6ba3cf9e5669a430048a76617d2ac.tar.bz2
* fix bug #254840
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/EcoreUtil2Tests.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/EcoreUtil2Tests.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/EcoreUtil2Tests.java
index 546c4dd..72bd458 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/EcoreUtil2Tests.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/EcoreUtil2Tests.java
@@ -7,9 +7,14 @@
*******************************************************************************/
package org.eclipse.xtext;
+import java.util.List;
+
import junit.framework.TestCase;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.EcorePackage;
@@ -83,4 +88,29 @@ public class EcoreUtil2Tests extends TestCase {
assertTrue(EcoreUtil2.getAllSuperTypes(a).contains(a));
assertTrue(EcoreUtil2.getAllSuperTypes(b).contains(b));
}
+
+ public void testGetAllReferencedObjects() {
+ EClass a = createEClass("a");
+ EClass b = createEClass("b");
+
+ EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
+ pack.setName("empty");
+ pack.setNsPrefix("empty");
+ pack.setNsURI("empty");
+ pack.getEClassifiers().add(a);
+ pack.getEClassifiers().add(b);
+
+ EReference ref = EcoreFactory.eINSTANCE.createEReference();
+ a.getEStructuralFeatures().add(ref);
+ ref.setUpperBound(1);
+ ref.setEType(b);
+ EObject objA = pack.getEFactoryInstance().create(a);
+ EObject objB = pack.getEFactoryInstance().create(b);
+ List<EObject> res = EcoreUtil2.getAllReferencedObjects(objA, ref);
+ assertNotNull(res);
+ assertTrue(res.isEmpty());
+ res = EcoreUtil2.getAllReferencedObjects(objA, ref);
+ assertNotNull(res);
+ objA.eSet(ref, objB);
+ }
}