/**
* Tests the clone() method.
*/
public void testClone() {
Mock mockParent1 = mock(CompositeNode.class);
NoteElement note = NoteElement.getPrototype();
assertNull(note.getParent());
assertNull(note.getModelElement());
note.setOrigin(0, 0);
note.setSize(100, 80);
note.setLabelText("oldlabel");
note.setParent((CompositeNode) mockParent1.proxy());
NoteElement cloned = (NoteElement) note.clone();
assertTrue(note != cloned);
assertEquals(note.getParent(), cloned.getParent());
assertEquals("oldlabel", cloned.getLabelText());
note.setLabelText("mylabel");
assertFalse(cloned.getLabelText() == note.getLabelText());
// now test the label
mockParent1.expects(atLeastOnce()).method("getAbsoluteX1")
.will(returnValue(0.0));
mockParent1.expects(atLeastOnce()).method("getAbsoluteY1")
.will(returnValue(0.0));
assertNotNull(cloned.getLabelAt(20, 20));
assertNull(cloned.getLabelAt(-1.0, -2.0));
assertTrue(cloned.getLabelAt(20.0, 20.0) != note.getLabelAt(20.0, 20.0));
assertTrue(cloned.getLabelAt(20.0, 20.0).getSource() == cloned);
assertTrue(cloned.getLabelAt(20.0, 20.0).getParent() == cloned);
}