Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhussey2006-06-14 22:09:58 +0000
committerkhussey2006-06-14 22:09:58 +0000
commit7fb3811d1184b14ed36a85a8fb5fbd8d13f73b0c (patch)
tree5fa4aeb44154ca6c2562c9c1cc0f8eb530fdfabc
parenta315bf7b791373d19ae175ee08f0cd7805eca15e (diff)
downloadorg.eclipse.uml2.test-7fb3811d1184b14ed36a85a8fb5fbd8d13f73b0c.tar.gz
org.eclipse.uml2.test-7fb3811d1184b14ed36a85a8fb5fbd8d13f73b0c.tar.xz
org.eclipse.uml2.test-7fb3811d1184b14ed36a85a8fb5fbd8d13f73b0c.zip
[80308] Implementing unit tests.
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ClassifierTest.java13
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ElementTest.java115
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/NamedElementTest.java7
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/OperationTest.java11
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PackageTest.java11
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PropertyTest.java11
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/StringExpressionTest.java11
-rw-r--r--tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/TemplateableElementTest.java11
8 files changed, 141 insertions, 49 deletions
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ClassifierTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ClassifierTest.java
index 14b8cc4b..035cdf25 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ClassifierTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ClassifierTest.java
@@ -8,11 +8,12 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ClassifierTest.java,v 1.5 2006/05/26 17:28:11 khussey Exp $
+ * $Id: ClassifierTest.java,v 1.6 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* <!-- begin-user-doc -->
@@ -246,11 +247,15 @@ public abstract class ClassifierTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Classifier#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature(
+ UMLPackage.Literals.REDEFINABLE_TEMPLATE_SIGNATURE);
+
+ assertTrue(getFixture().isTemplate());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ElementTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ElementTest.java
index 3e00f017..4b50efc9 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ElementTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/ElementTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ElementTest.java,v 1.6 2006/06/13 17:35:02 khussey Exp $
+ * $Id: ElementTest.java,v 1.7 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -28,6 +28,8 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.uml2.common.util.UML2Util;
+
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
@@ -132,11 +134,33 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#validateNotOwnSelf(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
- * @generated
+ * @generated NOT
*/
public void testValidateNotOwnSelf__DiagnosticChain_Map() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+
+ new UMLSwitch() {
+
+ public Object caseComment(Comment comment) {
+ caseElement(comment);
+
+ try {
+ comment.createOwnedComment().getOwnedComments()
+ .add(comment);
+ } catch (IllegalStateException ise) {
+ // ignore
+ }
+
+ assertFalse(comment.validateNotOwnSelf(null, null));
+
+ return comment;
+ }
+
+ public Object caseElement(Element element) {
+ assertTrue(element.validateNotOwnSelf(null, null));
+
+ return element;
+ }
+ }.doSwitch(getFixture());
}
/**
@@ -144,11 +168,36 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#validateHasOwner(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
- * @generated
+ * @generated NOT
*/
public void testValidateHasOwner__DiagnosticChain_Map() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+
+ new UMLSwitch() {
+
+ public Object caseElement(Element element) {
+ assertFalse(getFixture().validateHasOwner(null, null));
+
+ return element;
+ }
+
+ public Object casePackage(org.eclipse.uml2.uml.Package package_) {
+ assertTrue(getFixture().validateHasOwner(null, null));
+
+ return package_;
+ }
+
+ public Object casePackageableElement(
+ PackageableElement packageableElement) {
+ caseElement(packageableElement);
+
+ UMLFactory.eINSTANCE.createPackage().getPackagedElements().add(
+ packageableElement);
+
+ assertTrue(getFixture().validateHasOwner(null, null));
+
+ return packageableElement;
+ }
+ }.doSwitch(getFixture());
}
/**
@@ -156,7 +205,7 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#destroy()
- * @generated
+ * @generated NOT
*/
public void testDestroy() {
final Comment comment1 = UMLFactory.eINSTANCE.createComment();
@@ -207,7 +256,7 @@ public abstract class ElementTest
assertFalse(annotatedElements1.contains(element));
assertFalse(annotatedElements2.contains(element));
- return this;
+ return element;
}
public Object casePackageableElement(
@@ -222,7 +271,7 @@ public abstract class ElementTest
assertFalse(packagedElements.contains(packageableElement));
- return this;
+ return packageableElement;
}
}.doSwitch(getFixture());
}
@@ -237,8 +286,8 @@ public abstract class ElementTest
public void testHasKeyword__String() {
assertFalse(getFixture().hasKeyword(getName()));
- getFixture().createEAnnotation(UMLPackage.eNS_URI).getDetails().put(
- getName(), null);
+ UML2Util.createEAnnotation(getFixture(), UMLPackage.eNS_URI)
+ .getDetails().put(getName(), null);
assertTrue(getFixture().hasKeyword(getName()));
}
@@ -248,11 +297,15 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#getKeywords()
- * @generated
+ * @generated NOT
*/
public void testGetKeywords() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertTrue(getFixture().getKeywords().isEmpty());
+
+ UML2Util.createEAnnotation(getFixture(), UMLPackage.eNS_URI)
+ .getDetails().put(getName(), null);
+
+ assertTrue(getFixture().getKeywords().contains(getName()));
}
/**
@@ -260,11 +313,22 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#addKeyword(java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testAddKeyword__String() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertNull(getFixture().getEAnnotation(UMLPackage.eNS_URI));
+
+ assertTrue(getFixture().addKeyword(getName()));
+
+ EAnnotation eAnnotation = getFixture().getEAnnotation(
+ UMLPackage.eNS_URI);
+ assertNotNull(eAnnotation);
+ assertTrue(eAnnotation.getDetails().containsKey(getName()));
+
+ assertFalse(getFixture().addKeyword(getName()));
+
+ assertEquals(1, eAnnotation.getDetails().size());
+ assertTrue(eAnnotation.getDetails().containsKey(getName()));
}
/**
@@ -272,11 +336,20 @@ public abstract class ElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.Element#removeKeyword(java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testRemoveKeyword__String() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().removeKeyword(getName()));
+
+ EAnnotation eAnnotation = UML2Util.createEAnnotation(getFixture(),
+ UMLPackage.eNS_URI);
+ eAnnotation.getDetails().put(getName(), null);
+
+ assertTrue(getFixture().removeKeyword(getName()));
+
+ assertFalse(eAnnotation.getDetails().containsKey(getName()));
+
+ assertFalse(getFixture().removeKeyword(getName()));
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/NamedElementTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/NamedElementTest.java
index ae6c82cc..af2503f3 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/NamedElementTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/NamedElementTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: NamedElementTest.java,v 1.4 2006/05/26 17:28:10 khussey Exp $
+ * $Id: NamedElementTest.java,v 1.5 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -177,11 +177,10 @@ public abstract class NamedElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.NamedElement#separator()
- * @generated
+ * @generated NOT
*/
public void testSeparator() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertSame(NamedElement.SEPARATOR, getFixture().separator());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/OperationTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/OperationTest.java
index 8f0c897f..f8db972d 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/OperationTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/OperationTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: OperationTest.java,v 1.5 2006/05/26 17:28:10 khussey Exp $
+ * $Id: OperationTest.java,v 1.6 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -264,11 +264,14 @@ public class OperationTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.TemplateableElement#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature();
+
+ assertTrue(getFixture().isTemplate());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PackageTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PackageTest.java
index b852d1e2..02615a59 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PackageTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PackageTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: PackageTest.java,v 1.6 2006/06/13 17:35:02 khussey Exp $
+ * $Id: PackageTest.java,v 1.7 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -201,11 +201,14 @@ public class PackageTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.TemplateableElement#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature();
+
+ assertTrue(getFixture().isTemplate());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PropertyTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PropertyTest.java
index c336ed60..b52180b6 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PropertyTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/PropertyTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: PropertyTest.java,v 1.7 2006/06/13 17:35:02 khussey Exp $
+ * $Id: PropertyTest.java,v 1.8 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -289,11 +289,14 @@ public class PropertyTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.TemplateableElement#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature();
+
+ assertTrue(getFixture().isTemplate());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/StringExpressionTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/StringExpressionTest.java
index 70cda506..06e70148 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/StringExpressionTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/StringExpressionTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: StringExpressionTest.java,v 1.4 2006/05/26 17:28:11 khussey Exp $
+ * $Id: StringExpressionTest.java,v 1.5 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -104,11 +104,14 @@ public class StringExpressionTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.TemplateableElement#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature();
+
+ assertTrue(getFixture().isTemplate());
}
/**
diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/TemplateableElementTest.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/TemplateableElementTest.java
index ff62b1dd..9a08a0f5 100644
--- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/TemplateableElementTest.java
+++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/tests/TemplateableElementTest.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: TemplateableElementTest.java,v 1.4 2006/05/26 17:28:10 khussey Exp $
+ * $Id: TemplateableElementTest.java,v 1.5 2006/06/14 22:09:58 khussey Exp $
*/
package org.eclipse.uml2.uml.tests;
@@ -67,11 +67,14 @@ public abstract class TemplateableElementTest
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.uml.TemplateableElement#isTemplate()
- * @generated
+ * @generated NOT
*/
public void testIsTemplate() {
- // TODO: implement this feature getter test method
- // Ensure that you remove @generated or mark it @generated NOT
+ assertFalse(getFixture().isTemplate());
+
+ getFixture().createOwnedTemplateSignature();
+
+ assertTrue(getFixture().isTemplate());
}
} //TemplateableElementTest

Back to the top