Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 20585eb2a33780377958bec93c0b2c395c2213c9 (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*****************************************************************************
 * Copyright (c) 2015, 2016 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 v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Christian W. Damus - Initial API and implementation
 *   
 *****************************************************************************/

package org.eclipse.papyrus.uml.profile.assistants.generator.tests;

import java.util.Arrays;

import org.eclipse.papyrus.junit.framework.classification.ClassificationRunnerWithParametersFactory;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.xtext.xbase.lib.Pair;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.junit.runners.Parameterized.UseParametersRunnerFactory;

/**
 * Specific regression test cases verifying that connection assistants are inferred correctly for various types of
 * UML model elements.
 */
@RunWith(Parameterized.class)
@UseParametersRunnerFactory(ClassificationRunnerWithParametersFactory.class)
@PluginResource("/resources/edges.profile.uml")
public class ConnectionTypesTest {

	@ClassRule
	public static final ModelGenFixture fixture = new ModelGenFixture();

	private final String stereotypeName;
	private final String metaclassName;

	public ConnectionTypesTest(String metaclassName, String stereotypeName) {
		super();

		this.metaclassName = metaclassName;
		this.stereotypeName = stereotypeName;
	}

	@Parameters(name = "<<{1}>> {0}")
	public static Iterable<Object[]> data() {
		return Arrays.asList(new Object[][] {
				{ "Generalization", "Indirect" }, // As representative of Relationships
				{ "GeneralizationSet", "Indirect" }, // As representative of Relationships
				{ "ControlFlow", "Virtual" },
				{ "ObjectFlow", "Virtual" },
				{ "Transition", "Virtual" },
				{ "Message", "Virtual" },
				{ "Connector", "Indirect" },
		});
	}

	@Test
	public void connectionsGenerated() {
		Pair<Stereotype, Class> extension = fixture.getMetaclassExtension(stereotypeName, metaclassName);
		fixture.assertAllConnectionAssistants(extension);
	}

}

Back to the top