| /* |
| * Copyright (c) 2003, 2005 IBM Corporation 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: |
| * IBM - initial API and implementation |
| * |
| * $Id: ComponentTest.java,v 1.1 2005/04/04 20:06:07 khussey Exp $ |
| */ |
| package org.eclipse.uml2.tests; |
| |
| import java.util.Iterator; |
| |
| import junit.textui.TestRunner; |
| |
| import org.eclipse.uml2.Component; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.uml2.NamedElement; |
| import org.eclipse.uml2.PackageableElement; |
| import org.eclipse.uml2.UML2Factory; |
| import org.eclipse.uml2.UML2Package; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A test case for the model object '<em><b>Component</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are tested: |
| * <ul> |
| * <li>{@link org.eclipse.uml2.Component#getRequireds() <em>Required</em>}</li> |
| * <li>{@link org.eclipse.uml2.Component#getProvideds() <em>Provided</em>}</li> |
| * <li>{@link org.eclipse.uml2.Component#getRealizations() <em>Realization</em>}</li> |
| * </ul> |
| * </p> |
| * <p> |
| * The following operations are tested: |
| * <ul> |
| * <li>{@link org.eclipse.uml2.Component#getOwnedElements() <em>Get Owned Elements</em>}</li> |
| * <li>{@link org.eclipse.uml2.Component#getClientDependencies() <em>Get Client Dependencies</em>}</li> |
| * </ul> |
| * </p> |
| * @generated |
| */ |
| public class ComponentTest extends ClassTest { |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = "Copyright (c) 2003, 2005 IBM Corporation and others."; //$NON-NLS-1$ |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static void main(String[] args) { |
| TestRunner.run(ComponentTest.class); |
| } |
| |
| /** |
| * Constructs a new Component test case with the given name. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ComponentTest(String name) { |
| super(name); |
| } |
| |
| /** |
| * Returns the fixture for this Component test case. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private Component getFixture() { |
| return (Component)fixture; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see junit.framework.TestCase#setUp() |
| * @generated |
| */ |
| protected void setUp() throws Exception { |
| setFixture(UML2Factory.eINSTANCE.createComponent()); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see junit.framework.TestCase#tearDown() |
| * @generated |
| */ |
| protected void tearDown() throws Exception { |
| setFixture(null); |
| } |
| |
| /** |
| * Tests the '{@link org.eclipse.uml2.Component#getRequireds() <em>Required</em>}' feature getter. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.uml2.Component#getRequireds() |
| * @generated |
| */ |
| public void testGetRequireds() { |
| // TODO: implement this feature getter test method |
| // Ensure that you remove @generated or mark it @generated NOT |
| } |
| |
| /** |
| * Tests the '{@link org.eclipse.uml2.Component#getProvideds() <em>Provided</em>}' feature getter. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.uml2.Component#getProvideds() |
| * @generated |
| */ |
| public void testGetProvideds() { |
| // TODO: implement this feature getter test method |
| // Ensure that you remove @generated or mark it @generated NOT |
| } |
| |
| /** |
| * Tests the '{@link org.eclipse.uml2.Component#getRealizations() <em>Realization</em>}' feature getter. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.uml2.Component#getRealizations() |
| * @generated |
| */ |
| public void testGetRealizations() { |
| // TODO: implement this feature getter test method |
| // Ensure that you remove @generated or mark it @generated NOT |
| } |
| |
| /** |
| * Tests the '{@link org.eclipse.uml2.Component#getOwnedElements() <em>Get Owned Elements</em>}' getter operation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.uml2.Component#getOwnedElements() |
| * @generated |
| */ |
| public void testGetOwnedElementsGen() { |
| // TODO: implement this getter operation test method |
| // Ensure that you remove @generated or mark it @generated NOT |
| } |
| |
| public void testGetOwnedElements() { |
| testGetOwnedElementsGen(); |
| |
| super.testGetOwnedElements(); |
| |
| assertTrue(getFixture().getOwnedElements().containsAll(getFixture().getRealizations())); |
| } |
| |
| /** |
| * Tests the '{@link org.eclipse.uml2.Component#getClientDependencies() <em>Get Client Dependencies</em>}' getter operation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.uml2.Component#getClientDependencies() |
| * @generated |
| */ |
| public void testGetClientDependencies() { |
| // TODO: implement this getter operation test method |
| // Ensure that you remove @generated or mark it @generated NOT |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.uml2.impl.tests.ElementImplTest#setUpOwnedElements() |
| */ |
| protected void setUpOwnedElements() { |
| super.setUpOwnedElements(); |
| |
| getFixture().getRealizations().add(UML2Factory.eINSTANCE.createRealization()); |
| getFixture().getRealizations().add(UML2Factory.eINSTANCE.createRealization()); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.uml2.impl.tests.NamespaceImplTest#testGetOwnedMembers() |
| */ |
| public void testGetOwnedMembers() { |
| |
| for (Iterator eAllSubClasses = getEAllSubClasses(UML2Package.eINSTANCE.getNamedElement()).iterator(); eAllSubClasses.hasNext();) { |
| NamedElement namedElement = (NamedElement) UML2Factory.eINSTANCE.create((EClass) eAllSubClasses.next()); |
| |
| try { |
| getFixture().getOwnedMembers().add(namedElement); |
| |
| assertTrue(getFixture().getOwnedMembers().contains(namedElement)); |
| } catch (Exception e) { |
| assertFalse(PackageableElement.class.isInstance(namedElement)); |
| } |
| } |
| } |
| |
| } //ComponentImplTest |