### Question:
Domain { public abstract SortedSetModel<MetaAnalysis> getMetaAnalyses();  abstract List<EntityCategory> getCategories(); abstract ObservableList<? extends Entity> getCategoryContents(EntityCategory node); abstract EntityCategory getCategory(Entity entity); abstract EntityCategory getCategory(Class<? extends Entity> entityClass); abstract SortedSetModel<Drug> getDrugs(); abstract ObservableList<TreatmentCategorization> getTreatmentCategorizations(); abstract SortedSetModel<Indication> getIndications(); abstract SortedSetModel<Endpoint> getEndpoints(); abstract SortedSetModel<AdverseEvent> getAdverseEvents(); abstract SortedSetModel<PopulationCharacteristic> getPopulationCharacteristics(); abstract SortedSetModel<Study> getStudies(); abstract ObservableList<TreatmentCategorization> getCategorizations(final Drug drug); abstract SortedSetModel<MetaAnalysis> getMetaAnalyses(); abstract SortedSetModel<BenefitRiskAnalysis<?>> getBenefitRiskAnalyses(); abstract SortedSetModel<Unit> getUnits(); abstract void deleteEntity(Entity entity); abstract boolean hasDependents(Entity entity); abstract ObservableList<MetaAnalysis> getPairWiseMetaAnalyses(); abstract ObservableList<MetaAnalysis> getNetworkMetaAnalyses(); abstract ObservableList<Study> getStudies(Variable e); abstract ObservableList<Study> getStudies(Drug d); abstract ObservableList<Study> getStudies(Indication i); static final Unit GRAM; static final Unit LITER; }### Answer:
@Test(expected=NullPointerException.class) public void testAddMetaAnalysisNull() throws NullPointerException, IllegalArgumentException, EntityIdExistsException { d_domain.getMetaAnalyses().add(null); }
@Test(expected=IllegalArgumentException.class) public void testAddMetaAnalysisThrowsOnUnknownStudy() throws NullPointerException, IllegalArgumentException, EntityIdExistsException { List<Study> studies = new ArrayList<Study>(); studies.add(ExampleData.buildStudyChouinard()); studies.add(ExampleData.buildStudyDeWilde()); studies.add(new Study("iiidddd", ExampleData.buildIndicationDepression())); RandomEffectsMetaAnalysis ma = ExampleData.buildRandomEffectsMetaAnalysis("meta", ExampleData.buildEndpointHamd(), studies, TreatmentDefinition.createTrivial(ExampleData.buildDrugFluoxetine()), TreatmentDefinition.createTrivial(ExampleData.buildDrugParoxetine())); d_domain.getMetaAnalyses().add(ma); }
@Test public void testAddMetaAnalysis() throws Exception { assertEquals(0, d_domain.getMetaAnalyses().size()); ExampleData.initDefaultData(d_domain); RandomEffectsMetaAnalysis s = addMetaAnalysisToDomain(); assertTrue(d_domain.getMetaAnalyses().contains(s)); assertEquals(1, d_domain.getMetaAnalyses().size()); }
@Test(expected=IllegalArgumentException.class) public void testAddMetaAnalysisThrowsOnDifferentIndication() throws NullPointerException, IllegalArgumentException, EntityIdExistsException { List<Study> studies = new ArrayList<Study>(); studies.add(ExampleData.buildStudyChouinard()); Study study2 = ExampleData.buildStudyDeWilde(); study2.setIndication(ExampleData.buildIndicationChronicHeartFailure()); studies.add(study2); RandomEffectsMetaAnalysis ma = ExampleData.buildRandomEffectsMetaAnalysis("meta", ExampleData.buildEndpointHamd(), studies, TreatmentDefinition.createTrivial(ExampleData.buildDrugFluoxetine()), TreatmentDefinition.createTrivial(ExampleData.buildDrugParoxetine())); d_domain.getMetaAnalyses().add(ma); }