svn commit: r15231 - branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: maurelio1234
Date: 2008-07-10 01:56:19-0700
New Revision: 15231
Modified:
branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java
Log:
tests for loading profile from JAR
Modified: branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java?view=diff&rev=15231&p1=branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java&p2=branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java&r1=15230&r2=15231
==============================================================================
--- branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java (original)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java 2008-07-10 01:56:19-0700
@@ -25,11 +25,16 @@
package org.argouml.profile;
import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
import junit.framework.TestCase;
import org.argouml.FileHelper;
import org.argouml.model.InitializeModel;
+import org.argouml.profile.internal.ProfileManagerImpl;
+import org.argouml.profile.internal.ocl.CrOCL;
+import org.argouml.uml.cognitive.critics.CrUML;
/**
* Some basic tests for the {@link UserDefinedProfile} class.
@@ -70,4 +75,35 @@
assertTrue(profile.getDisplayName().contains(profileFile.getName()));
}
+ /**
+ * Test the constructor used for loading a profile from a Jar file
+ *
+ * TODO Test FigNode!
+ *
+ * @throws Exception if something goes wrong
+ */
+ public void testLoadingAsFromJar() throws Exception {
+ ProfileManager pm = new ProfileManagerImpl();
+
+ // create profile model
+ ProfileMother profileMother = new ProfileMother();
+ Object model = profileMother.createSimpleProfileModel();
+ // save the profile into a xmi file
+ File profileFile = new File(testDir, "testLoadingConstructor.xmi");
+ profileMother.saveProfileModel(model, profileFile);
+
+ CrOCL critic = new CrOCL("context Class inv: 3 > 2");
+ Set<CrUML> critics = new HashSet<CrUML>();
+ critics.add(critic);
+
+ Set<Profile> profiles = new HashSet<Profile>();
+ profiles.add(pm.getUMLProfile());
+
+ Profile profile = new UserDefinedProfile("displayName", profileFile
+ .toURI().toURL(), critics, profiles);
+
+ assertEquals(profile.getDisplayName(), "displayName");
+ assertTrue(profile.getDependencies().contains(pm.getUMLProfile()));
+ assertTrue(profile.getCritics().contains(critic));
+ }
}