### Question:
DomainTreeModel implements TreeModel { public boolean isLeaf(Object node) { if (node instanceof Entity) { EntityCategory category = d_domain.getCategory(((Entity) node)); if (category != null) { return d_domain.getCategoryContents(category).contains(node); } } return false; } 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 testIsLeaf() { assertFalse(d_treeModel.isLeaf(d_treeModel.getRoot())); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(Indication.class))); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(Endpoint.class))); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(AdverseEvent.class))); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(Study.class))); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(Drug.class))); assertFalse(d_treeModel.isLeaf(d_domain.getCategory(MetaAnalysis.class))); assertTrue(d_treeModel.isLeaf(d_firstIndication)); assertTrue(d_treeModel.isLeaf(d_firstEndpoint)); assertTrue(d_treeModel.isLeaf(d_firstADE)); assertTrue(d_treeModel.isLeaf(d_firstPopChar)); assertTrue(d_treeModel.isLeaf(d_firstStudy)); assertTrue(d_treeModel.isLeaf(d_firstDrug)); assertTrue(d_treeModel.isLeaf(d_firstMetaAnalysis)); }
@Test public void testMetaStudyIsLeaf() throws NullPointerException, IllegalArgumentException, EntityIdExistsException { RandomEffectsMetaAnalysis study = ExampleData.buildRandomEffectsMetaAnalysis("meta2", d_firstEndpoint, new ArrayList<Study>(Collections.singleton(d_firstStudy)), TreatmentDefinition.createTrivial(d_firstDrug), TreatmentDefinition.createTrivial(d_firstDrug)); d_domain.getMetaAnalyses().add(study); assertTrue(d_treeModel.isLeaf(study)); assertTrue(d_treeModel.isLeaf(d_firstMetaAnalysis)); }