diff options
author | Francois Le Fevre - CEA | 2015-07-30 12:52:36 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-07-31 09:05:24 +0000 |
commit | 6cf7525658f8d338ab0d37952c3d8a23c2246653 (patch) | |
tree | 51b5b0bae7f4119c1ab7339278a498ff2b6feb39 /tests/junit/plugins | |
parent | 442d8281b85683617a683fe2524654ddb1522396 (diff) | |
download | org.eclipse.papyrus-6cf7525658f8d338ab0d37952c3d8a23c2246653.tar.gz org.eclipse.papyrus-6cf7525658f8d338ab0d37952c3d8a23c2246653.tar.xz org.eclipse.papyrus-6cf7525658f8d338ab0d37952c3d8a23c2246653.zip |
Bug 473906 - [Test]: several corrections to provide for
stereotypeproperty test
Change-Id: I68dbdaaeded2cb4b9d7bc38cec9613e34166097e
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=473906
Signed-off-by: Francois Le Fevre - CEA <francois.le-fevre@cea.fr>
Diffstat (limited to 'tests/junit/plugins')
5 files changed, 59 insertions, 126 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestBadUnapplyProfile2ClosedDiagComment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestBadUnapplyProfile2ClosedDiagComment.java index f6ec66f49e0..6693ff56efe 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestBadUnapplyProfile2ClosedDiagComment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestBadUnapplyProfile2ClosedDiagComment.java @@ -53,30 +53,24 @@ public class TestBadUnapplyProfile2ClosedDiagComment extends AbstractPapyrusTest //Check initial model NamedElement stereotypedClass = fixture.getModel().getOwnedMember(STEREOTYPEDCLASS); EditPart stereotypedClassEditPart = fixture.findEditPart(stereotypedClass); + boolean isPresent=false; for(Object o : stereotypedClassEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent =true; } } - //List of EditPart - //ClassNameEditPart - //ClassAttributeCompartmentEditPart - //ClassOperationCompartmentEditPart - //ClassnestedclassifierCompartemtnEditPart - //ClassFloatingNameEditPart - assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 5, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$ - + assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$ + NamedElement stereotypedLink = fixture.getModel().getOwnedMember(STEREOTYPEDLINK); EditPart stereotypedLinkEditPart = fixture.findEditPart(stereotypedLink); + isPresent=false; for(Object o : stereotypedLinkEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent=true; } } - //List of EditPart - //DependencyNameEditPart - //AppliedStereotypeDependencyEditPart - assertEquals(STEREOTYPEDLINK + " has not the right number of children", 2, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$ + assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$ + } diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java index 2923e746ec1..84f7f8d5c4f 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2ClosedDiagComment.java @@ -68,35 +68,25 @@ public class TestUnapplyProfile2ClosedDiagComment extends AbstractPapyrusTestCas NamedElement stereotypedLink = fixture.getModel().getOwnedMember(STEREOTYPEDLINK); assertNotNull("stereotypedLink is null", stereotypedLink); - + boolean isPresent=false; //Check initial model EditPart stereotypedClassEditPart = fixture.findEditPart(stereotypedClass); for(Object o : stereotypedClassEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent=true; } } - //List of EditPart - //ClassNameEditPart - //ClassAttributeCompartmentEditPart - //ClassOperationCompartmentEditPart - //ClassNestedclassifierCompartemtnEditPart - //ClassFloatingNameEditPart - //AppliedStereotypeEmptyEditPart - assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 6, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$ - + assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent); //$NON-NLS-1$ + EditPart stereotypedLinkEditPart = fixture.findEditPart(stereotypedLink); + isPresent=false; for(Object o : stereotypedLinkEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent=true; } } - //List of EditPart - //DependencyNameEditPart - //AppliedStereotypeDependencyEditPart - //AppliedStereotypeEmptyEditPart - assertEquals(STEREOTYPEDLINK + " has not the right number of children", 3, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$ - + assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent); //$NON-NLS-1$ + fixture.closeDiagram("ClassDiagram"); //Remove the stereotypes @@ -110,30 +100,23 @@ public class TestUnapplyProfile2ClosedDiagComment extends AbstractPapyrusTestCas fixture.openDiagram("ClassDiagram"); //check the final model - //List of EditPart - //ClassNameEditPart - //ClassAttributeCompartmentEditPart - //ClassOperationCompartmentEditPart - //ClassNestedclassifierCompartemtnEditPart - //ClassFloatingNameEditPart - //AppliedStereotypeEmptyEditPart --> should be removed - assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 5, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$ + isPresent=false; for(Object ee : stereotypedClassEditPart.getChildren()){ EditPart a = (EditPart)ee; if(a instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", false); //$NON-NLS-1$ + isPresent=true; } } + assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$ //List of EditPart - //DependencyNameEditPart - //AppliedStereotypeDependencyEditPart - //AppliedStereotypeEmptyEditPart --> should be removed - assertEquals(STEREOTYPEDLINK + " has not the right number of children", 2, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$ + isPresent=false; for(Object ee : stereotypedLinkEditPart.getChildren()){ EditPart a = (EditPart)ee; if(a instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", false); //$NON-NLS-1$ + isPresent=true; } } + assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$ + } } diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java index c1ac178e700..df37994c98f 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyProfile2Comment.java @@ -13,7 +13,6 @@ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotypeproperty;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.eclipse.emf.common.util.EList;
@@ -61,32 +60,24 @@ public class TestUnapplyProfile2Comment extends AbstractPapyrusTestCase { //Check initial model
NamedElement stereotypedClass = fixture.getModel().getOwnedMember(STEREOTYPEDCLASS);
EditPart stereotypedClassEditPart = fixture.findEditPart(stereotypedClass);
+ boolean isPresent=false;
for(Object o : stereotypedClassEditPart.getChildren()){
if(o instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$
+ isPresent=true;
}
}
- //List of EditPart
- //ClassNameEditPart
- //ClassAttributeCompartmentEditPart
- //ClassOperationCompartmentEditPart
- //ClassNestedclassifierCompartemtnEditPart
- //ClassFloatingNameEditPart
- //AppliedStereotypeEmptyEditPart
- assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 6, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$
+
+ assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent); //$NON-NLS-1$
NamedElement stereotypedLink = fixture.getModel().getOwnedMember(STEREOTYPEDLINK);
EditPart stereotypedLinkEditPart = fixture.findEditPart(stereotypedLink);
+ isPresent=false;
for(Object o : stereotypedLinkEditPart.getChildren()){
if(o instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$
+ isPresent=true;
}
}
- //List of EditPart
- //DependencyNameEditPart
- //AppliedStereotypeDependencyEditPart
- //AppliedStereotypeEmptyEditPart
- assertEquals(STEREOTYPEDLINK + " has not the right number of children", 3, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$
+ assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$
//Remove the stereotypes
@@ -99,31 +90,23 @@ public class TestUnapplyProfile2Comment extends AbstractPapyrusTestCase { }
//check the final model
- //List of EditPart
- //ClassNameEditPart
- //ClassAttributeCompartmentEditPart
- //ClassOperationCompartmentEditPart
- //ClassNestedclassifierCompartemtnEditPart
- //ClassFloatingNameEditPart
- //AppliedStereotypeEmptyEditPart --> should be removed
- assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 5, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$
+ isPresent=false;
for(Object ee : stereotypedClassEditPart.getChildren()){
EditPart a = (EditPart)ee;
if(a instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", false); //$NON-NLS-1$
+ isPresent=true;
}
}
- //List of EditPart
- //DependencyNameEditPart
- //AppliedStereotypeDependencyEditPart
- //AppliedStereotypeEmptyEditPart --> should be removed
- assertEquals(STEREOTYPEDLINK + " has not the right number of children", 2, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$
+ assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$
+
+ isPresent=false;
for(Object ee : stereotypedLinkEditPart.getChildren()){
EditPart a = (EditPart)ee;
if(a instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", false); //$NON-NLS-1$
+ isPresent=true;
}
}
+ assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent); //$NON-NLS-1$
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java index 8ad9354b219..5d42394b52f 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/TestUnapplyStereotypeComment.java @@ -58,36 +58,26 @@ public class TestUnapplyStereotypeComment extends AbstractPapyrusTestCase { editor = fixture.getEditor(MODEL_DI);
fixture.openDiagram("ClassDiagram");
-
+ boolean isPresent=false;
//Check initial model
NamedElement stereotypedClass = fixture.getModel().getOwnedMember(STEREOTYPEDCLASS);
EditPart stereotypedClassEditPart = fixture.findEditPart(stereotypedClass);
for(Object o : stereotypedClassEditPart.getChildren()){
if(o instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", true);
+ isPresent=true;
}
}
- //List of EditPart
- //ClassNameEditPart
- //ClassAttributeCompartmentEditPart
- //ClassOperationCompartmentEditPart
- //ClassNestedclassifierCompartemtnEditPart
- //ClassFloatingNameEditPart
- //AppliedStereotypeEmptyEditPart
- assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 6, stereotypedClassEditPart.getChildren().size());
+ assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent);
NamedElement stereotypedLink = fixture.getModel().getOwnedMember(STEREOTYPEDLINK);
EditPart stereotypedLinkEditPart = fixture.findEditPart(stereotypedLink);
+ isPresent=false;
for(Object o : stereotypedLinkEditPart.getChildren()){
if(o instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true);
+ isPresent=true;
}
}
- //List of EditPart
- //DependencyNameEditPart
- //AppliedStereotypeDependencyEditPart
- //AppliedStereotypeEmptyEditPart
- assertEquals(STEREOTYPEDLINK + " has not the right number of children", 3, stereotypedLinkEditPart.getChildren().size());
+ assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent);
//Remove the stereotypes
EList<NamedElement> elements= fixture.getModel().getOwnedMembers();
@@ -104,31 +94,24 @@ public class TestUnapplyStereotypeComment extends AbstractPapyrusTestCase { }
//check the final model
- //List of EditPart
- //ClassNameEditPart
- //ClassAttributeCompartmentEditPart
- //ClassOperationCompartmentEditPart
- //ClassNestedclassifierCompartemtnEditPart
- //ClassFloatingNameEditPart
- //AppliedStereotypeEmptyEditPart --> removed
- assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 5, stereotypedClassEditPart.getChildren().size());
+
+ isPresent=false;
for(Object ee : stereotypedClassEditPart.getChildren()){
EditPart a = (EditPart)ee;
if(a instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", false);
+ isPresent=true;
}
}
- //List of EditPart
- //DependencyNameEditPart
- //AppliedStereotypeDependencyEditPart
- //AppliedStereotypeEmptyEditPart --> removed
- assertEquals(STEREOTYPEDLINK + " has not the right number of children", 2, stereotypedLinkEditPart.getChildren().size());
+ assertTrue(STEREOTYPEDCLASS+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent);
+ isPresent=false;
for(Object ee : stereotypedLinkEditPart.getChildren()){
EditPart a = (EditPart)ee;
if(a instanceof AppliedStereotypeEmptyEditPart){
- assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", false);
+ isPresent=true;
}
}
+ assertTrue(STEREOTYPEDLINK+" still refer to a AppliedStereotypeEmptyEditPart comment", !isPresent);
+
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java index 41f9ad7d95c..1e4be31c365 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/uml/diagram/stereotypeproperty/tests/creation/TestCreationReopen2Comment.java @@ -54,37 +54,27 @@ public class TestCreationReopen2Comment extends AbstractPapyrusTestCase { editor = fixture.getEditor(MODEL_DI); fixture.openDiagram("ClassDiagram"); //$NON-NLS-1$ - + boolean isPresent=false; //Check initial model NamedElement stereotypedClass = fixture.getModel().getOwnedMember(STEREOTYPEDCLASS); EditPart stereotypedClassEditPart = fixture.findEditPart(stereotypedClass); for(Object o : stereotypedClassEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent=true; } } - //List of EditPart - //ClassNameEditPart - //ClassAttributeCompartmentEditPart - //ClassOperationCompartmentEditPart - //ClassNestedclassifierCompartemtnEditPart - //ClassFloatingNameEditPart - //AppliedStereotypeEmptyEditPart - assertEquals(STEREOTYPEDCLASS + " has not the right number of children", 6, stereotypedClassEditPart.getChildren().size()); //$NON-NLS-1$ - + assertTrue(STEREOTYPEDCLASS+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent); //$NON-NLS-1$ + NamedElement stereotypedLink = fixture.getModel().getOwnedMember(STEREOTYPEDLINK); EditPart stereotypedLinkEditPart = fixture.findEditPart(stereotypedLink); + isPresent=false; for(Object o : stereotypedLinkEditPart.getChildren()){ if(o instanceof AppliedStereotypeEmptyEditPart){ - assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", true); //$NON-NLS-1$ + isPresent=true; } } - //List of EditPart - //DependencyNameEditPart - //AppliedStereotypeDependencyEditPart - //AppliedStereotypeEmptyEditPart - assertEquals(STEREOTYPEDLINK + " has not the right number of children", 3, stereotypedLinkEditPart.getChildren().size()); //$NON-NLS-1$ - + assertTrue(STEREOTYPEDLINK+" do not refer to any AppliedStereotypeEmptyEditPart comment", isPresent); //$NON-NLS-1$ + } |