svn commit: r12918 - branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: maurelio1234
Date: 2007-06-28 05:51:11-0700
New Revision: 12918
Modified:
branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java
Log:
Uploading tests to repository
Modified: branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java?view=diff&rev=12918&p1=branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java&p2=branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java&r1=12917&r2=12918
==============================================================================
--- branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java (original)
+++ branches/gsoc2007/maurelio1234/tests/org/argouml/uml/profile/TestProfileManagerImpl.java 2007-06-28 05:51:11-0700
@@ -24,6 +24,62 @@
package org.argouml.uml.profile;
-public class TestProfileManagerImpl {
+import java.io.File;
+import junit.framework.TestCase;
+
+/**
+ * Tests for the default implementation of the ProfileManager
+ *
+ * @author Marcos Aurélio
+ */
+public class TestProfileManagerImpl extends TestCase {
+ /**
+ * The constructor.
+ *
+ * @param name the name of the test.
+ */
+ public TestProfileManagerImpl(String name) {
+ super(name);
+ }
+
+ /**
+ * Test whether the ProfileManager can register a new profile
+ */
+ public void testRegisterProfile() {
+ Profile profile = new UserDefinedProfile(new File("someprofile"));
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+ manager.registerProfile(profile);
+ assertTrue("Profile was not correctly registered", manager
+ .getRegisteredProfiles().contains(profile));
+ }
+
+ /**
+ * Test whether the ProfileManager can remove a previously registered
+ * profile
+ */
+ public void testUnregisterRegisteredProfile() {
+ Profile profile = new UserDefinedProfile(new File("someprofile"));
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ if (!manager.getRegisteredProfiles().contains(profile)) {
+ manager.registerProfile(profile);
+ manager.removeProfile(profile);
+ assertTrue("Profile was not correctly unregistered", !manager
+ .getRegisteredProfiles().contains(profile));
+ }
+ }
+
+ /**
+ * Test whether the ProfileManager can handle a non proviously registered
+ * profile being removed. In this case it should not raise any exception.
+ */
+ public void testUnregisterUnknownProfile() {
+ Profile profile = new UserDefinedProfile(new File("someprofile"));
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ if (!manager.getRegisteredProfiles().contains(profile)) {
+ manager.removeProfile(profile);
+ }
+ }
}