blob: 841179bbacf0db5a9a702095c9694ab9b27b5baa [file] [log] [blame]
/*
* Copyright (c) 2018 CEA, 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:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.uml2.uml.cdo.tests.compliance;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.ConnectionPointReference;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.FinalState;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.StringExpression;
/**
* @author Eike Stepper
*/
public class ConnectionPointReferenceTest
extends _Abstract_Compliance_Test_ {
public void testEAnnotations() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
EAnnotation eAnnotation = ECORE.createEAnnotation();
assertValid(eAnnotation);
connectionPointReference.getEAnnotations().add(eAnnotation);
}
public void testOwnedComment() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
Comment comment = UML.createComment();
assertValid(comment);
connectionPointReference.getOwnedComments().add(comment);
assertSuperset(
connectionPointReference.getOwnedElements().contains(comment));
}
public void testOwnedElement() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
EList<Element> elements = connectionPointReference.getOwnedElements();
EList<Element> elements2 = connectionPointReference.getOwnedElements();
assertSame(elements, elements2);
}
public void testClientDependency() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
EList<Dependency> dependencys = connectionPointReference
.getClientDependencies();
EList<Dependency> dependencys2 = connectionPointReference
.getClientDependencies();
assertSame(dependencys, dependencys2);
}
public void testNameExpression() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
StringExpression stringExpression = UML.createStringExpression();
assertValid(stringExpression);
connectionPointReference.setNameExpression(stringExpression);
assertSuperset(connectionPointReference.getOwnedElements()
.contains(stringExpression));
}
public void testContainer() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
Region region = UML.createRegion();
assertValid(region);
connectionPointReference.setContainer(region);
assertSuperset(connectionPointReference.getNamespace() == region);
}
public void testEntry() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
Pseudostate pseudostate = UML.createPseudostate();
assertValid(pseudostate);
connectionPointReference.getEntries().add(pseudostate);
}
public void testExit() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
Pseudostate pseudostate = UML.createPseudostate();
assertValid(pseudostate);
connectionPointReference.getExits().add(pseudostate);
}
public void testState() {
ConnectionPointReference connectionPointReference = UML
.createConnectionPointReference();
assertValid(connectionPointReference);
FinalState finalState = UML.createFinalState();
assertValid(finalState);
connectionPointReference.setState(finalState);
assertSuperset(connectionPointReference.getNamespace() == finalState);
State state = UML.createState();
assertValid(state);
connectionPointReference.setState(state);
assertSuperset(connectionPointReference.getNamespace() == state);
}
}