Mock mockNester = mock(CompositeNode.class);
mockDiagram.expects(once()).method("getChildAt")
.will(returnValue(mockNester.proxy()));
mockNester.expects(once()).method("canNestElements")
.will(returnValue(true));
mockNester.expects(once()).method("getAbsoluteBounds")
.will(returnValue(new Rectangle2D.Double(0, 0, 100, 100)));
mockNode.expects(once()).method("recalculateSize");
mockNode.expects(once()).method("getAbsoluteBounds")
.will(returnValue(new Rectangle2D.Double(5, 5, 10, 10)));
mockDrawingContext.expects(exactly(2)).method("drawRectangle");