blob: 5010c7e1b44c8e8f4b2dffa73ac773c8f5a5f37b [file] [log] [blame]
/*
* Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
*
* $Id: ComponentImplTest.java,v 1.2 2004/05/20 03:03:32 khussey Exp $
*/
package org.eclipse.uml2.impl.tests;
import java.util.Iterator;
import junit.textui.TestRunner;
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;
import org.eclipse.uml2.impl.ComponentImpl;
/**
* <!-- 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.impl.ComponentImpl#getRequireds() <em>Required</em>}</li>
* <li>{@link org.eclipse.uml2.impl.ComponentImpl#getProvideds() <em>Provided</em>}</li>
* <li>{@link org.eclipse.uml2.impl.ComponentImpl#getRealizations() <em>Realization</em>}</li>
* </ul>
* </p>
* <p>
* The following operations are tested:
* <ul>
* <li>{@link org.eclipse.uml2.impl.ComponentImpl#getOwnedElements() <em>Get Owned Elements</em>}</li>
* <li>{@link org.eclipse.uml2.impl.ComponentImpl#getClientDependencies() <em>Get Client Dependencies</em>}</li>
* </ul>
* </p>
* @generated
*/
public class ComponentImplTest extends ClassImplTest {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) 2003, 2004 IBM Corporation and others."; //$NON-NLS-1$
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(ComponentImplTest.class);
}
/**
* Constructs a new Component test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ComponentImplTest(String name) {
super(name);
}
/**
* Returns the fixture for this Component test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private ComponentImpl getFixture() {
return (ComponentImpl) fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
protected void setUp() throws Exception {
setFixture((ComponentImpl) 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.impl.ComponentImpl#getRequireds() <em>Required</em>}' feature getter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.impl.ComponentImpl#getRequireds()
* @generated
*/
public void testGetRequireds() {
// TODO: implement this feature getter test method
}
/**
* Tests the '{@link org.eclipse.uml2.impl.ComponentImpl#getProvideds() <em>Provided</em>}' feature getter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.impl.ComponentImpl#getProvideds()
* @generated
*/
public void testGetProvideds() {
// TODO: implement this feature getter test method
}
/**
* Tests the '{@link org.eclipse.uml2.impl.ComponentImpl#getRealizations() <em>Realization</em>}' feature getter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.impl.ComponentImpl#getRealizations()
* @generated
*/
public void testGetRealizations() {
// TODO: implement this feature getter test method
}
/**
* Tests the '{@link org.eclipse.uml2.impl.ComponentImpl#getOwnedElements() <em>Get Owned Elements</em>}' getter operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.impl.ComponentImpl#getOwnedElements()
* @generated
*/
public void testGetOwnedElementsGen() {
// TODO: implement this getter operation test method
}
public void testGetOwnedElements() {
testGetOwnedElementsGen();
super.testGetOwnedElements();
assertTrue(getFixture().getOwnedElements().containsAll(getFixture().getRealizations()));
}
/**
* Tests the '{@link org.eclipse.uml2.impl.ComponentImpl#getClientDependencies() <em>Get Client Dependencies</em>}' getter operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.impl.ComponentImpl#getClientDependencies()
* @generated
*/
public void testGetClientDependencies() {
// TODO: implement this getter operation test method
}
/* (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