Mock mockNode2 = mock(Node.class);
double node2X2 = 55.0, node2Y2 = 67.0;
mockNode2.expects(once()).method("setParent").with(eq(diagram));
mockNode2.expects(atLeastOnce()).method("getAbsoluteX2").
will(returnValue(node2X2));
mockNode2.expects(atLeastOnce()).method("getAbsoluteY2").
will(returnValue(node2Y2));
diagram.addChild((DiagramElement) mockNode2.proxy());
assertTrue(diagram.getSize().getWidth() >= node2X2);
assertTrue(diagram.getSize().getHeight() >= node2Y2);
diagram.removeChild((DiagramElement) mockNode2.proxy());