@Test public void shouldSave() throws Exception { VaccineIvdTabVisibility visibility = new VaccineIvdTabVisibility(); VaccineIvdTabVisibility visibility1 = new VaccineIvdTabVisibility(); visibility.setId(23L); List<VaccineIvdTabVisibility> list = asList(visibility, visibility1); service.save(list, 2L); verify(repository).insert(visibility1); verify(repository).update(visibility); }
public void save(List<VaccineIvdTabVisibility> visibilities, Long programId){ for(VaccineIvdTabVisibility visibility : visibilities){ if(!visibility.hasId()){ visibility.setProgramId(programId); repository.insert(visibility); }else{ repository.update(visibility); } } }
VaccineIvdTabVisibilityService { public void save(List<VaccineIvdTabVisibility> visibilities, Long programId){ for(VaccineIvdTabVisibility visibility : visibilities){ if(!visibility.hasId()){ visibility.setProgramId(programId); repository.insert(visibility); }else{ repository.update(visibility); } } } }
VaccineIvdTabVisibilityService { public void save(List<VaccineIvdTabVisibility> visibilities, Long programId){ for(VaccineIvdTabVisibility visibility : visibilities){ if(!visibility.hasId()){ visibility.setProgramId(programId); repository.insert(visibility); }else{ repository.update(visibility); } } }  }
VaccineIvdTabVisibilityService { public void save(List<VaccineIvdTabVisibility> visibilities, Long programId){ for(VaccineIvdTabVisibility visibility : visibilities){ if(!visibility.hasId()){ visibility.setProgramId(programId); repository.insert(visibility); }else{ repository.update(visibility); } } }  List<VaccineIvdTabVisibility> getVisibilityForProgram(Long programId); void save(List<VaccineIvdTabVisibility> visibilities, Long programId); }
VaccineIvdTabVisibilityService { public void save(List<VaccineIvdTabVisibility> visibilities, Long programId){ for(VaccineIvdTabVisibility visibility : visibilities){ if(!visibility.hasId()){ visibility.setProgramId(programId); repository.insert(visibility); }else{ repository.update(visibility); } } }  List<VaccineIvdTabVisibility> getVisibilityForProgram(Long programId); void save(List<VaccineIvdTabVisibility> visibilities, Long programId);  }