svn commit: r14956 - trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java
[email protected] 15 Jun 2008 21:12:38 -0000
Newsgroups
gmane.comp.lang.uml.argouml.cvs
Message-ID
<[email protected] >
Author: tfmorris
Date: 2008-06-15 14:12:38-0700
New Revision: 14956
Modified:
trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java
Log:
Issue 5062: prevent Realizations and Abstractions being created to self
Modified: trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java?view=diff&rev=14956&p1=trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java&p2=trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java&r1=14955&r2=14956
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/model/TestCoreFactory.java 2008-06-15 14:12:38-0700
@@ -597,5 +597,40 @@
}
+ /**
+ * Test buildRealization and buildAbstraction
+ */
+ public void testBuildRealization() {
+ Object model = Model.getModelManagementFactory().createModel();
+ Object client = Model.getCoreFactory().buildClass("ClassA", model);
+ Object supplier = Model.getCoreFactory().buildInterface("InterfaceB",
+ model);
+ Object realization = Model.getCoreFactory().buildRealization(client,
+ supplier, model);
+
+ assertTrue(Model.getFacade().isAAbstraction(realization));
+ assertTrue(Model.getExtensionMechanismsHelper().hasStereotype(
+ realization, "realize"));
+
+ try {
+ Model.getCoreFactory().buildRealization(supplier, supplier, model);
+ fail("buildRealization to self didn't throw exception");
+ } catch (Exception e) {
+ // success
+ }
+
+ Object abstraction = Model.getCoreFactory().buildAbstraction("foo",
+ supplier, client);
+ assertTrue(Model.getFacade().isAAbstraction(abstraction));
+
+ try {
+ Model.getCoreFactory().buildAbstraction("foo2", supplier, supplier);
+ fail("buildAbstraction to self didn't throw exception");
+ } catch (Exception e) {
+ // success
+ }
+
+ }
+
}