final Object otherChild2 = delegateModel2.getChild(delegateRoot2, 1);  assertEquals(1, delegateModel2.getIndexOfChild(delegateRoot2, otherChild2)); assertEquals(2, compositeTreeModel.getIndexOfChild(root, otherChild2));
  public void testGetChildMethods() throws Exception {    final CompositeTreeModel compositeTreeModel = new CompositeTreeModel();    final Object root = compositeTreeModel.getRoot();    assertNull(compositeTreeModel.getChild(root, -10));    assertNull(compositeTreeModel.getChild(root, 0));    assertNull(compositeTreeModel.getChild(new Object(), 0));    assertEquals(0, compositeTreeModel.getChildCount(root));    assertEquals(0, compositeTreeModel.getChildCount(new Object()));    final TreeModel delegateModel1 = createTreeModel();    final DelegatingStubFactory delegateModelStubFactory1 =      new DelegatingStubFactory(createTreeModel());    final TreeModel instrumentedDelegateModel1 =      (TreeModel)delegateModelStubFactory1.getStub();    compositeTreeModel.addTreeModel(instrumentedDelegateModel1, true);    assertSame(root, compositeTreeModel.getRoot());    assertNull(compositeTreeModel.getChild(root, -10));    // Identity not equal because of wrapping: compare node text    // instead.    assertEquals("Root", compositeTreeModel.getChild(root, 0).toString());    assertNull(compositeTreeModel.getChild(root, 1));    delegateModelStubFactory1.assertSuccess("getRoot");    final Object delegateRoot1 = delegateModel1.getRoot();    assertNull(compositeTreeModel.getChild(root, 1));    assertEquals("Child2",                 compositeTreeModel.getChild(delegateRoot1, 1).toString());    delegateModelStubFactory1.assertSuccess("getChild", delegateRoot1,                                            new Integer(1));    assertEquals(1, compositeTreeModel.getChildCount(root));    assertEquals(2, compositeTreeModel.getChildCount(delegateRoot1));    delegateModelStubFactory1.assertSuccess("getChildCount", delegateRoot1);    delegateModelStubFactory1.assertNoMoreCalls();    final TreeModel delegateModel2 = createTreeModel();    final DelegatingStubFactory delegateModelStubFactory2 =      new DelegatingStubFactory(createTreeModel());    final TreeModel instrumentedDelegateModel2 =      (TreeModel)delegateModelStubFactory2.getStub();    final Object delegateRoot2 = delegateModel1.getRoot();    compositeTreeModel.addTreeModel(instrumentedDelegateModel2, false);    assertEquals(3, compositeTreeModel.getChildCount(root));    assertEquals("Child1",                 compositeTreeModel.getChild(delegateRoot1, 0).toString());    delegateModelStubFactory1.assertSuccess("getChild", delegateRoot1,                                            new Integer(0));    assertEquals("Child1", compositeTreeModel.getChild(root, 1).toString());    assertEquals("Child2", compositeTreeModel.getChild(root, 2).toString());  }