### Question:
DomainTreeModel implements TreeModel { public void addTreeModelListener(TreeModelListener listener) { if (!d_listeners.contains(listener)) { d_listeners.add(listener); } } 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 testAddEndpointFires() { TreeModelListener listener = createMock(TreeModelListener.class); listener.treeNodesInserted((TreeModelEvent)notNull()); replay(listener); d_treeModel.addTreeModelListener(listener); d_domain.getEndpoints().add(new Endpoint("E", Endpoint.convertVarType(Variable.Type.RATE))); verify(listener); }
@Test public void testAddAdeFires() { TreeModelListener listener = createMock(TreeModelListener.class); listener.treeNodesInserted((TreeModelEvent)notNull()); replay(listener); d_treeModel.addTreeModelListener(listener); d_domain.getAdverseEvents().add(new AdverseEvent()); verify(listener); }
@Test public void testAddStudyFires() { TreeModelListener listener = createMock(TreeModelListener.class); listener.treeNodesInserted((TreeModelEvent)notNull()); replay(listener); d_treeModel.addTreeModelListener(listener); d_domain.getStudies().add(new Study("X", d_firstIndication)); verify(listener); }
@Test public void testAddDrugFires() { TreeModelListener listener = createMock(TreeModelListener.class); listener.treeNodesInserted((TreeModelEvent)notNull()); replay(listener); d_treeModel.addTreeModelListener(listener); d_domain.getDrugs().add(new Drug("X", "atc")); verify(listener); }
@Test public void testAddPopCharFires() { TreeModelListener listener = createMock(TreeModelListener.class); listener.treeNodesInserted((TreeModelEvent)notNull()); replay(listener); d_treeModel.addTreeModelListener(listener); d_domain.getPopulationCharacteristics().add(new PopulationCharacteristic("X", new ContinuousVariableType())); verify(listener); }