svn commit: r13756 - trunk/tests/org/argouml/model/TestModelManagementHelper.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-11-11 03:17:06-0800
New Revision: 13756

Modified:
   trunk/tests/org/argouml/model/TestModelManagementHelper.java

Log:
Add test for getElement

Modified: trunk/tests/org/argouml/model/TestModelManagementHelper.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/tests/org/argouml/model/TestModelManagementHelper.java?view=diff&rev=13756&p1=trunk/tests/org/argouml/model/TestModelManagementHelper.java&p2=trunk/tests/org/argouml/model/TestModelManagementHelper.java&r1=13755&r2=13756
==============================================================================
--- trunk/tests/org/argouml/model/TestModelManagementHelper.java	(original)
+++ trunk/tests/org/argouml/model/TestModelManagementHelper.java	2007-11-11 03:17:06-0800
@@ -26,6 +26,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import junit.framework.TestCase;
 
@@ -41,7 +42,7 @@
     private Object theStereotype;
     private Object theTagDefinition;
     private Object theClass;
-    private Collection<String> tdPath = new ArrayList<String>();
+    private List<String> tdPath = new ArrayList<String>();
 
     /**
      * Constructor for TestModelManagementHelper.
@@ -153,6 +154,7 @@
     
     /**
      * Test the getPath method with a tag definition contained in a stereotype.
+     * Also test lookup of element by path name in a series of namespaces.
      */
     public void testGetPathForTagDefinitionInStereotype() {
         setUpTestsOfTagDefinitionContainedInStereotype();
@@ -161,5 +163,11 @@
                 theTagDefinition);
         assertEquals("Wrong path returned for TagDefinition", 
                 tdPath, path);
+        
+        // Go the other way to lookup an element by path 
+        Object st =
+                Model.getModelManagementHelper().getElement(
+                        tdPath.subList(1, 3), theModel);
+        assertEquals("Found wrong element", theStereotype, st);
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.