@Test public void shouldUpdateRequisitionGroupProgramScheduleWhenIdIsNotNull() throws Exception { RequisitionGroupProgramSchedule requisitionGroupProgramSchedule = new RequisitionGroupProgramSchedule(); requisitionGroupProgramSchedule.setId(1L); service.save(requisitionGroupProgramSchedule); verify(requisitionGroupProgramScheduleRepository).update(requisitionGroupProgramSchedule); verify(requisitionGroupProgramScheduleRepository, never()).insert(requisitionGroupProgramSchedule); }
public void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { if (requisitionGroupProgramSchedule.getId() != null) { repository.update(requisitionGroupProgramSchedule); return; } repository.insert(requisitionGroupProgramSchedule); }
RequisitionGroupProgramScheduleService { public void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { if (requisitionGroupProgramSchedule.getId() != null) { repository.update(requisitionGroupProgramSchedule); return; } repository.insert(requisitionGroupProgramSchedule); } }
RequisitionGroupProgramScheduleService { public void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { if (requisitionGroupProgramSchedule.getId() != null) { repository.update(requisitionGroupProgramSchedule); return; } repository.insert(requisitionGroupProgramSchedule); }  }
RequisitionGroupProgramScheduleService { public void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { if (requisitionGroupProgramSchedule.getId() != null) { repository.update(requisitionGroupProgramSchedule); return; } repository.insert(requisitionGroupProgramSchedule); }  void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule); RequisitionGroupProgramSchedule getScheduleForRequisitionGroupCodeAndProgramCode(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule); List<RequisitionGroupProgramSchedule> getByRequisitionGroupId(Long requisitionGroupId); void deleteRequisitionGroupProgramSchedulesFor(Long requisitionGroupId); }
RequisitionGroupProgramScheduleService { public void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { if (requisitionGroupProgramSchedule.getId() != null) { repository.update(requisitionGroupProgramSchedule); return; } repository.insert(requisitionGroupProgramSchedule); }  void save(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule); RequisitionGroupProgramSchedule getScheduleForRequisitionGroupCodeAndProgramCode(RequisitionGroupProgramSchedule requisitionGroupProgramSchedule); List<RequisitionGroupProgramSchedule> getByRequisitionGroupId(Long requisitionGroupId); void deleteRequisitionGroupProgramSchedulesFor(Long requisitionGroupId);  }