Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2017-01-17 11:52:58 +0000
committerRemi Schnekenburger2017-01-20 09:31:32 +0000
commitd053ab0e57db25303604ea58c7e82b2d22dd7ce4 (patch)
treedb27cc2e684a7c946b5bd485f161a9311e15f416
parentb539435af5541538bce8807440131902de347485 (diff)
downloadorg.eclipse.papyrus-d053ab0e57db25303604ea58c7e82b2d22dd7ce4.tar.gz
org.eclipse.papyrus-d053ab0e57db25303604ea58c7e82b2d22dd7ce4.tar.xz
org.eclipse.papyrus-d053ab0e57db25303604ea58c7e82b2d22dd7ce4.zip
Bug 495430 - Duplicated transitions in a model closed then reopened
- Added test (cherry picked from commit d767d384224d89f97f0506b3787a3412bdad23ab) Change-Id: I1fd015bcde25f5db19847d3b5edf2c31ca63ac80
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java1
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug495430_DuplicatedTransitionsTest.java51
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
index a04ba025b66..a19e271c234 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
@@ -39,6 +39,7 @@ import org.junit.runners.Suite.SuiteClasses;
CanonicalRegressionTest.class,
ShapeCustomisationTest.class,
Bug476873_MoveCommandTest.class,
+ Bug495430_DuplicatedTransitionsTest.class,
Bug488744_PortPositionTest.class
})
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug495430_DuplicatedTransitionsTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug495430_DuplicatedTransitionsTest.java
new file mode 100644
index 00000000000..bb2a0890499
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug495430_DuplicatedTransitionsTest.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA) - Initial API and Implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.tests.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.uml.diagram.common.canonical.DefaultUMLSemanticChildrenStrategy;
+import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The Class Bug495430_DuplicatedTransitionsTest.
+ */
+public class Bug495430_DuplicatedTransitionsTest extends AbstractPapyrusTest {
+
+ @Before
+ public void init() {
+ }
+
+ /**
+ * Tests of the move of one generalization.
+ */
+ @Test
+ public void checkDuplication() {
+ DefaultUMLSemanticChildrenStrategy semanticChildrenStrategy = new DefaultUMLSemanticChildrenStrategy();
+ State state = UMLFactory.eINSTANCE.createState();
+ Transition transition = UMLFactory.eINSTANCE.createTransition();
+ // transition is a self-transition, i.e. appears in the incomings and outgoings list
+ state.getIncomings().add(transition);
+ state.getOutgoings().add(transition);
+ // yet, the transition should appear only once in the result list.
+ List<? extends EObject> tst = semanticChildrenStrategy.getCanonicalSemanticConnections(state, null);
+ assert tst.size() == 1;
+ }
+}

Back to the top