Author: maurelio1234
Date: 2007-08-17 14:43:12-0700
New Revision: 13384
Modified:
branches/gsoc2007/maurelio1234/branch2/tests/.classpath
branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java
Log:
improving tests
solving bugs
improving documentation
Modified: branches/gsoc2007/maurelio1234/branch2/tests/.classpath
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/tests/.classpath?view=diff&rev=13384&p1=branches/gsoc2007/maurelio1234/branch2/tests/.classpath&p2=branches/gsoc2007/maurelio1234/branch2/tests/.classpath&r1=13383&r2=13384
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/tests/.classpath (original)
+++ branches/gsoc2007/maurelio1234/branch2/tests/.classpath 2007-08-17 14:43:12-0700
@@ -6,6 +6,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/argouml-core-lib"/>
<classpathentry combineaccessrules="false" kind="src" path="/argouml-core-tools"/>
<classpathentry kind="lib" path="/argouml-core-tools/jdepend-2.9/lib/jdepend-2.9.jar" sourcepath="/argouml-core-tools/jdepend-2.9/src/"/>
- <classpathentry combineaccessrules="false" kind="src" path="/argouml_branch"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/argouml"/>
<classpathentry kind="output" path="build-eclipse"/>
</classpath>
Modified: branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java?view=diff&rev=13384&p1=branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java&r1=13383&r2=13384
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java (original)
+++ branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/uml/profile/TestProfileManagerImpl.java 2007-08-17 14:43:12-0700
@@ -48,11 +48,33 @@
Profile profile = new FakeProfile();
ProfileManager manager = ProfileManagerImpl.getInstance();
manager.registerProfile(profile);
+
assertTrue("Profile was not correctly registered", manager
.getRegisteredProfiles().contains(profile));
+
+ assertTrue("getProfileForClass() doesn't work", manager
+ .getProfileForClass(FakeProfile.class.getName()) == profile);
}
/**
+ * Test whether the ProfileManager can register a default profile
+ */
+ public void testRegisterDefaultProfile() {
+ Profile profile = new FakeProfile();
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ manager.addToDefaultProfiles(profile);
+ assertTrue("Unregistered profile was registered as default!", !manager
+ .getDefaultProfiles().contains(profile));
+
+ manager.registerProfile(profile);
+ manager.addToDefaultProfiles(profile);
+
+ assertTrue("Profile was not correctly registered as default!", manager
+ .getDefaultProfiles().contains(profile));
+ }
+
+ /**
* Test whether the ProfileManager can remove a previously registered
* profile
*/
@@ -63,13 +85,14 @@
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
+ * Test whether the ProfileManager can handle a non previously registered
* profile being removed. In this case it should not raise any exception.
*/
public void testUnregisterUnknownProfile() {
@@ -80,4 +103,103 @@
manager.removeProfile(profile);
}
}
+
+ /**
+ * Test whether the ProfileManager can remove a profile previously
+ * registered as default
+ */
+ public void testUnregisterAsDefaultRegisteredProfile() {
+ Profile profile = new FakeProfile();
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ if (!manager.getRegisteredProfiles().contains(profile)) {
+ manager.registerProfile(profile);
+ manager.addToDefaultProfiles(profile);
+ manager.removeProfile(profile);
+
+ assertTrue("Profile was not correctly unregistered", !manager
+ .getRegisteredProfiles().contains(profile));
+
+ assertTrue("Profile was not correctly unregistered from the default profiles", !manager
+ .getDefaultProfiles().contains(profile));
+ }
+ }
+
+ /**
+ * Test whether the ProfileManager can remove a profile previously
+ * registered as default.
+ */
+ public void testUnregisterAsDefaultRegisteredProfile2() {
+ Profile profile = new FakeProfile();
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ if (!manager.getRegisteredProfiles().contains(profile)) {
+ manager.registerProfile(profile);
+ manager.registerProfile(profile);
+ manager.removeFromDefaultProfiles(profile);
+
+ assertTrue("Profile was not correctly unregistered from the default profiles", !manager
+ .getDefaultProfiles().contains(profile));
+ }
+ }
+
+ /**
+ * Test whether the ProfileManager can handle a non previously registered
+ * profile being removed from the default profiles.
+ * In this case it should not raise any exception.
+ */
+ public void testUnregisterAsDefaultUnknownProfile() {
+ Profile profile = new FakeProfile();
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ if (!manager.getRegisteredProfiles().contains(profile)) {
+ manager.removeFromDefaultProfiles(profile);
+ }
+ }
+
+ /**
+ * Test whether the ProfileManager can register a search path directory
+ */
+ public void testRegisterSearchPathDirectory() {
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ String dir = "c:\temp";
+ manager.addSearchPathDirectory(dir);
+ assertTrue("Search directory was not registered!", !manager
+ .getSearchPathDirectories().contains(dir));
+ }
+
+ /**
+ * Test whether the ProfileManager can unregister a search path directory
+ */
+ public void testUnregisterSearchPathDirectory() {
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+
+ String dir = "c:\temp";
+ manager.addSearchPathDirectory(dir);
+ manager.removeSearchPathDirectory(dir);
+ assertTrue("Search directory was not unregistered!", manager
+ .getSearchPathDirectories().contains(dir));
+ }
+
+ /**
+ * Test whether the ProfileManager can unregister an unknown
+ * search path directory. This should raise no exception.
+ */
+ public void testUnregisterUnknownSearchPathDirectory() {
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+ manager.removeSearchPathDirectory("hello world!");
+ }
+
+ /**
+ * Test whether the ProfileManager can register an invalid
+ * search path directory and run the refreshRegisteredProfiles()
+ * without raising any exceptions.
+ */
+ public void testRegisterInvalidSearchPathDirectory() {
+ ProfileManager manager = ProfileManagerImpl.getInstance();
+ manager.addSearchPathDirectory("/#/@!*&");
+ manager.refreshRegisteredProfiles();
+ }
+
}
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.