| /* |
| * 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.Constraint; |
| import org.eclipse.uml2.uml.Dependency; |
| import org.eclipse.uml2.uml.DurationConstraint; |
| import org.eclipse.uml2.uml.Element; |
| import org.eclipse.uml2.uml.Extend; |
| import org.eclipse.uml2.uml.ExtensionPoint; |
| import org.eclipse.uml2.uml.InteractionConstraint; |
| import org.eclipse.uml2.uml.IntervalConstraint; |
| import org.eclipse.uml2.uml.StringExpression; |
| import org.eclipse.uml2.uml.TimeConstraint; |
| import org.eclipse.uml2.uml.UseCase; |
| |
| /** |
| * @author Eike Stepper |
| */ |
| public class ExtendTest |
| extends _Abstract_Compliance_Test_ { |
| |
| public void testEAnnotations() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| EAnnotation eAnnotation = ECORE.createEAnnotation(); |
| assertValid(eAnnotation); |
| extend.getEAnnotations().add(eAnnotation); |
| } |
| |
| public void testOwnedComment() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| Comment comment = UML.createComment(); |
| assertValid(comment); |
| extend.getOwnedComments().add(comment); |
| assertSuperset(extend.getOwnedElements().contains(comment)); |
| } |
| |
| public void testOwnedElement() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| EList<Element> elements = extend.getOwnedElements(); |
| EList<Element> elements2 = extend.getOwnedElements(); |
| assertSame(elements, elements2); |
| } |
| |
| public void testClientDependency() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| EList<Dependency> dependencys = extend.getClientDependencies(); |
| EList<Dependency> dependencys2 = extend.getClientDependencies(); |
| assertSame(dependencys, dependencys2); |
| } |
| |
| public void testNameExpression() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| StringExpression stringExpression = UML.createStringExpression(); |
| assertValid(stringExpression); |
| extend.setNameExpression(stringExpression); |
| assertSuperset(extend.getOwnedElements().contains(stringExpression)); |
| } |
| |
| public void testRelatedElement() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| EList<Element> elements = extend.getRelatedElements(); |
| EList<Element> elements2 = extend.getRelatedElements(); |
| assertSame(elements, elements2); |
| } |
| |
| public void testSource() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| EList<Element> elements = extend.getSources(); |
| EList<Element> elements2 = extend.getSources(); |
| assertSame(elements, elements2); |
| } |
| |
| public void testTarget() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| EList<Element> elements = extend.getTargets(); |
| EList<Element> elements2 = extend.getTargets(); |
| assertSame(elements, elements2); |
| } |
| |
| public void testCondition() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| IntervalConstraint intervalConstraint = UML.createIntervalConstraint(); |
| assertValid(intervalConstraint); |
| extend.setCondition(intervalConstraint); |
| assertSuperset(extend.getOwnedElements().contains(intervalConstraint)); |
| |
| TimeConstraint timeConstraint = UML.createTimeConstraint(); |
| assertValid(timeConstraint); |
| extend.setCondition(timeConstraint); |
| assertSuperset(extend.getOwnedElements().contains(timeConstraint)); |
| |
| Extend extend2 = UML.createExtend(); |
| assertValid(extend2); |
| |
| InteractionConstraint interactionConstraint = UML |
| .createInteractionConstraint(); |
| assertValid(interactionConstraint); |
| extend2.setCondition(interactionConstraint); |
| assertSuperset( |
| extend2.getOwnedElements().contains(interactionConstraint)); |
| |
| Constraint constraint = UML.createConstraint(); |
| assertValid(constraint); |
| extend2.setCondition(constraint); |
| assertSuperset(extend2.getOwnedElements().contains(constraint)); |
| |
| Extend extend3 = UML.createExtend(); |
| assertValid(extend3); |
| |
| DurationConstraint durationConstraint = UML.createDurationConstraint(); |
| assertValid(durationConstraint); |
| extend3.setCondition(durationConstraint); |
| assertSuperset(extend3.getOwnedElements().contains(durationConstraint)); |
| } |
| |
| public void testExtendedCase() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| UseCase useCase = UML.createUseCase(); |
| assertValid(useCase); |
| extend.setExtendedCase(useCase); |
| assertSuperset(extend.getTargets().contains(useCase)); |
| } |
| |
| public void testExtensionLocation() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| ExtensionPoint extensionPoint = UML.createExtensionPoint(); |
| assertValid(extensionPoint); |
| extend.getExtensionLocations().add(extensionPoint); |
| } |
| |
| public void testExtension() { |
| Extend extend = UML.createExtend(); |
| assertValid(extend); |
| |
| UseCase useCase = UML.createUseCase(); |
| assertValid(useCase); |
| extend.setExtension(useCase); |
| assertSuperset(extend.getSources().contains(useCase)); |
| assertSuperset(extend.getNamespace() == useCase); |
| } |
| |
| } |