### Question:
DomainTreeModel implements TreeModel { public int getChildCount(Object parent) { if (d_root.equals(parent)) { return d_domain.getCategories().size(); } else { ObservableList<? extends Entity> contents = d_domain.getCategoryContents(getCategoryNode(parent)); if (contents != null) { return contents.size(); } } return 0; } 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 testGetChildCount() { assertEquals(d_domain.getCategories().size(), d_treeModel.getChildCount(d_treeModel.getRoot())); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(PairWiseMetaAnalysis.class))); assertEquals(0, d_treeModel.getChildCount(d_domain.getCategory(NetworkMetaAnalysis.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(Indication.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(Indication.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(Endpoint.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(AdverseEvent.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(PopulationCharacteristic.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(Drug.class))); assertEquals(1, d_treeModel.getChildCount(d_domain.getCategory(Study.class))); assertEquals(0, d_treeModel.getChildCount(d_domain.getCategory(MetaBenefitRiskAnalysis.class))); assertEquals(0, d_treeModel.getChildCount(d_firstEndpoint)); }