* Tests the clone() method.
*/
public void testClone() {
UmlPackage pkg = UmlPackage.getPrototype();
pkg.setName("mypackage");
PackageElement pkgElem = (PackageElement)
PackageElement.getPrototype().clone();
pkgElem.setUmlPackage(pkg);
PackageElement cloned = (PackageElement) pkgElem.clone();
assertTrue(pkgElem != cloned);
assertEquals(pkgElem.getModelElement().getName(),
cloned.getModelElement().getName());
assertTrue(pkgElem.getModelElement() != cloned.getModelElement());
assertTrue(pkgElem.getMainLabel() != cloned.getMainLabel());
assertTrue(cloned.getMainLabel().getSource() == cloned);
assertTrue(cloned.getMainLabel().getParent() ==
cloned.getMainCompartment());
assertTrue(pkgElem.getTabCompartment() != cloned.getTabCompartment());
assertTrue(cloned.getTabCompartment().getParent() == cloned);
assertTrue(pkgElem.getMainCompartment() != cloned.getMainCompartment());
assertTrue(cloned.getMainCompartment().getParent() == cloned);
assertEquals(1, cloned.getMainCompartment().getLabels().size());
assertTrue(cloned.getMainCompartment().getLabels()
.contains(cloned.getMainLabel()));
}