svn commit: r14610 - trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2008-05-04 02:14:06-0700
New Revision: 14610

Modified:
   trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java

Log:
Refactored the test to make the before/after comparison clearer.

Modified: trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java?view=diff&rev=14610&p1=trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java&p2=trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java&r1=14609&r2=14610
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java	(original)
+++ trunk/src/argouml-app/tests/org/argouml/persistence/TestXmiFilePersister.java	2008-05-04 02:14:06-0700
@@ -114,6 +114,8 @@
         Object attribute = 
             Model.getCoreFactory().buildAttribute2(classifier, intType);
         Model.getCoreHelper().setName(attribute, "profileTypedAttribute");
+        checkFoo(project.findType("Foo", false));
+
         File file = File.createTempFile("ArgoTestCreateSaveAndLoad", ".xmi");
         XmiFilePersister persister = new XmiFilePersister();
         project.preSave();
@@ -126,14 +128,20 @@
         
         persister = new XmiFilePersister();
         project = persister.doLoad(file);
-        Object loadedClass = project.findType("Foo", false);
-        assertNotNull(loadedClass);
-        Object att = Model.getFacade().getAttributes(loadedClass).get(0);
+        Object attType = checkFoo(project.findType("Foo", false));
+
+        assertEquals("Integer", Model.getFacade().getName(attType));
+
+        file.delete();
+    }
+
+    private Object checkFoo(Object theClass) {
+        assertNotNull(theClass);
+        Object att = Model.getFacade().getAttributes(theClass).get(0);
         assertNotNull(att);
         Object attType = Model.getFacade().getType(att);
         assertNotNull(attType);
-        assertEquals("Integer", Model.getFacade().getName(attType));
-        file.delete();
+        return attType;
     }
 
     /**
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.