/
Bug511674Test.java
55 lines (43 loc) · 1.65 KB
/
Bug511674Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2017, 2018 Christian W. Damus and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Christian W. Damus - Initial API and implementation
* Kenn Hussey - 535301
*
*/
package org.eclipse.uml2.uml.bug.tests;
import java.util.Arrays;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class Bug511674Test extends TestCase {
public Bug511674Test() {
super();
}
public static Test suite() {
return new TestSuite(Bug511674Test.class, "Bug 511674 tests"); //$NON-NLS-1$
}
/**
* This test passes because the {@code redefinedClassifier} superset
* now includes the {@code redefinedBehavior} subset which in
* {@link StateMachine} is redefined as {@code extendedStateMachine}.
*/
public void testExtendedStateMachines() {
org.eclipse.uml2.uml.Class class1 = UMLFactory.eINSTANCE.createClass();
org.eclipse.uml2.uml.Class class2 = UMLFactory.eINSTANCE.createClass();
class2.createGeneralization(class1);
StateMachine sm1 = (StateMachine) class1.createClassifierBehavior(null, UMLPackage.Literals.STATE_MACHINE);
StateMachine sm2 = (StateMachine) class2.createClassifierBehavior(null, UMLPackage.Literals.STATE_MACHINE);
sm2.getExtendedStateMachines().add(sm1);
assertEquals(Arrays.asList(sm1), sm2.getRedefinedElements());
}
}