}
public void testSimpleClone ()
throws CloneNotSupportedException
{
final StyleSheetCollection sc = new StyleSheetCollection();
final ElementStyleSheet es1 = sc.createStyleSheet("one");
final ElementStyleSheet es2 = sc.createStyleSheet("two");
final ElementStyleSheet es3 = sc.createStyleSheet("three");
final ElementStyleSheet es4 = sc.createStyleSheet("four");
es1.addParent(es2);
es1.addParent(es4);
es2.addParent(es3);
es3.addParent(es4);
try
{
es4.addParent(es1);
fail("Loop not detected");
}
catch(Exception e)
{
}
final StyleSheetCollection scc = (StyleSheetCollection) sc.clone();
final ElementStyleSheet esc1 = scc.getStyleSheet("one");
final ElementStyleSheet esc2 = scc.getStyleSheet("two");
final ElementStyleSheet esc3 = scc.getStyleSheet("three");
final ElementStyleSheet esc4 = scc.getStyleSheet("four");
assertEquals(es1.getId(), esc1.getId());
assertEquals(es2.getId(), esc2.getId());
assertEquals(es3.getId(), esc3.getId());
assertEquals(es4.getId(), esc4.getId());