SampleWrapper implements BioMoleculeWrapperI { @Override public void saveAll(SampleService sampleService){ if (parent != null) parent.saveAll(sampleService); if (sample.getSampleId() == null){ sampleService.saveSampleWithAssociatedMeta(sample); } } 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 testSaveAll(){ Sample otherParent = new Sample(); otherParent.setSampleId(3); SampleService mockSampleService = createMockBuilder(SampleServiceImpl.class).addMockedMethods(SampleServiceImpl.class.getMethods()).createMock(); Assert.assertNotNull(mockSampleService); replay(mockSampleService); SampleWrapper managedSample = new SampleWrapper(sample); managedSample.saveAll(mockSampleService); verify(mockSampleService); }