### Question:
DomainTreeModel implements TreeModel { public Object getChild(Object parent, int childIndex) { if (d_root.equals(parent) && childIndex >= 0 && childIndex < d_domain.getCategories().size()) { return d_domain.getCategories().get(childIndex); } else { for (EntityCategory cat : d_domain.getCategories()) { if (isCategoryRequest(cat, parent, childIndex)) { return d_domain.getCategoryContents(cat).get(childIndex); } } } return null; } DomainTreeModel(Domain domain); Object getChild(Object parent, int childIndex); int getChildCount(Object parent); int getIndexOfChild(Object parent, Object child); Object getRoot(); boolean isLeaf(Object node); TreePath getPathTo(Object node); void addTreeModelListener(TreeModelListener listener); void removeTreeModelListener(TreeModelListener listener); void valueForPathChanged(TreePath path, Object node);  }### Answer:
@Test public void testGetIndication() { assertEquals(d_firstIndication, d_treeModel.getChild(d_domain.getCategory(Indication.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(Indication.class), 1)); }
@Test public void testGetEndpoint() { assertEquals(d_firstEndpoint, d_treeModel.getChild(d_domain.getCategory(Endpoint.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(Endpoint.class), 1)); }
@Test public void testGetADE() { assertEquals(d_firstADE, d_treeModel.getChild(d_domain.getCategory(AdverseEvent.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(AdverseEvent.class), 1)); }
@Test public void testGetPopChar() { assertEquals(d_firstPopChar, d_treeModel.getChild(d_domain.getCategory(PopulationCharacteristic.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(AdverseEvent.class), 1)); }
@Test public void testGetDrug() { assertEquals(d_firstDrug, d_treeModel.getChild(d_domain.getCategory(Drug.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(Drug.class), 1)); }
@Test public void testGetAnalysis() { assertEquals(null, d_treeModel.getChild(d_domain.getCategory(NetworkMetaAnalysis.class), 0)); assertEquals(d_firstMetaAnalysis, d_treeModel.getChild(d_domain.getCategory(PairWiseMetaAnalysis.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(PairWiseMetaAnalysis.class), 1)); }
@Test public void testGetStudy() { assertEquals(d_firstStudy, d_treeModel.getChild(d_domain.getCategory(Study.class), 0)); assertEquals(null, d_treeModel.getChild(d_domain.getCategory(Study.class), 1)); }