svn commit: r14437 - trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-04-22 11:45:15-0700
New Revision: 14437

Modified:
   trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java

Log:
Avoid NPE on Model with null name (e.g. unnamed profile)

Modified: trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java?view=diff&rev=14437&p1=trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java&p2=trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java&r1=14436&r2=14437
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java	(original)
+++ trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java	2008-04-22 11:45:15-0700
@@ -37,6 +37,7 @@
 import org.argouml.notation.providers.java.InitNotationJava;
 import org.argouml.notation.providers.uml.InitNotationUml;
 import org.argouml.persistence.AbstractFilePersister;
+import org.argouml.persistence.OpenException;
 import org.argouml.persistence.PersistenceManager;
 import org.argouml.profile.init.InitProfileSubsystem;
 import org.argouml.ui.targetmanager.TargetManager;
@@ -77,9 +78,11 @@
      * Test remove() function. This is called when a new project is created to
      * remove the old project. We confirm here that the users model has been
      * emptied and that no none 'Model' model elements are at root.
-     * @throws Exception
+     * 
+     * @throws InterruptedException if there the project load was interrupted
+     * @throws OpenException if there was an error during project load
      */
-    public void testRemove() throws Exception {
+    public void testRemove() throws OpenException, InterruptedException {
         String name = "/testmodels/uml14/Alittlebitofeverything.zargo";
         URL url = TestProject.class.getResource(name);
         AbstractFilePersister persister =
@@ -95,7 +98,7 @@
                     Model.getFacade().isAModel(root));
             System.out.println(Model.getFacade().getName(root) + " "
                     + Model.getFacade().getOwnedElements(root).size());
-            if (Model.getFacade().getName(root).equals("untitledModel")) {
+            if ("untitledModel".equals(Model.getFacade().getName(root))) {
                 assertEquals(
                         "All root models should be empty", 0, 
                         Model.getFacade().getOwnedElements(root).size());
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.