SampleWrapper implements BioMoleculeWrapperI { @Override public List<SampleMeta> getMetaTemplatedToSampleSybtype(SampleSubtype sampleSubtype) { List<SampleMeta> templateSampleMeta = new ArrayList<SampleMeta>(); List<String> sampleSubtypeComponentAreas = sampleSubtype.getComponentMetaAreas(); for(String area : sampleSubtypeComponentAreas){ templateSampleMeta.addAll(MetaHelper.getMetaSubsetByArea(area, this.getAllSampleMeta())); } return templateSampleMeta; } SampleWrapper(Sample sample); @Override List<SampleMeta> getAllSampleMeta(); @Override Sample getSampleObject(); @Override SampleWrapper getParentWrapper(); @Override Set<String> getAllSampleMetaAreas(); @Override List<SampleMeta> getMetaTemplatedToSampleSybtype(SampleSubtype sampleSubtype); @Override void setParent(Sample parentSample); @Override List<SampleMeta> updateMetaToList(List<SampleMeta> inputMetaList, SampleMetaDao sampleMetaDao); @Override void saveAll(SampleService sampleService);  }
@Test (groups = "unit-tests", dependsOnMethods = {"testSampleWrapperConstruct"}) public void testGetMetaTemplatedToSampleSybtype(){ SampleWrapper managedSample = new SampleWrapper(sample); SampleSubtype testSampleSubtype1 = new SampleSubtype(); SampleSubtype testSampleSubtype2 = new SampleSubtype(); SampleSubtype testSampleSubtype3 = new SampleSubtype(); testSampleSubtype1.setAreaList("sampleMeta1"); testSampleSubtype2.setAreaList("sampleMeta1,parentSampleMeta2"); testSampleSubtype3.setAreaList("sampleMeta1,parentSampleMeta2,anotherArea"); List<SampleMeta> result1 = managedSample.getMetaTemplatedToSampleSybtype(testSampleSubtype1); List<SampleMeta> result2 = managedSample.getMetaTemplatedToSampleSybtype(testSampleSubtype2); List<SampleMeta> result3 = managedSample.getMetaTemplatedToSampleSybtype(testSampleSubtype3); Assert.assertEquals(result1.size(),2); Assert.assertEquals(result2.size(),4); Assert.assertEquals(result3.size(),4); }