UmlStereotype stereo = (UmlStereotype) UmlStereotype.getPrototype().clone();
stereo.setName("stereotype" + i);
stereotypes.add(stereo);
}
UmlClass original = UmlClass.getPrototype();
original.setAttributes(attributes);
original.setMethods(methods);
original.setStereotypes(stereotypes);
UmlClass cloned = (UmlClass) original.clone();
assertTrue(original.getAttributes() != cloned.getAttributes());
assertEquals(original.getAttributes().size(),
cloned.getAttributes().size());
for (int i = 0; i < cloned.getAttributes().size(); i++) {
assertTrue(original.getAttributes().get(i) ==
cloned.getAttributes().get(i));
}
assertTrue(original.getMethods() != cloned.getMethods());
assertEquals(original.getMethods().size(), cloned.getMethods().size());
for (int i = 0; i < cloned.getMethods().size(); i++) {
assertTrue(original.getMethods().get(i) ==
cloned.getMethods().get(i));
}
assertTrue(original.getStereotypes() != cloned.getStereotypes());
assertEquals(original.getStereotypes().size(),
cloned.getStereotypes().size());
for (int i = 0; i < cloned.getStereotypes().size(); i++) {
assertTrue(original.getStereotypes().get(i) ==
cloned.getStereotypes().get(i));
}
}