@Test public void shouldThrowErrorIfInvalidProgramCode() throws Exception { when(programService.getByCode(deliveryZoneProgramSchedule.getProgram().getCode())).thenReturn(null); expectedException.expect(DataException.class); expectedException.expectMessage("program.code.invalid"); service.save(deliveryZoneProgramSchedule); }
public void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule) { fillProgram(deliveryZoneProgramSchedule); fillDeliveryZone(deliveryZoneProgramSchedule); fillSchedule(deliveryZoneProgramSchedule); if (deliveryZoneProgramSchedule.getId() == null) repository.insert(deliveryZoneProgramSchedule); else repository.update(deliveryZoneProgramSchedule); }
DeliveryZoneProgramScheduleService { public void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule) { fillProgram(deliveryZoneProgramSchedule); fillDeliveryZone(deliveryZoneProgramSchedule); fillSchedule(deliveryZoneProgramSchedule); if (deliveryZoneProgramSchedule.getId() == null) repository.insert(deliveryZoneProgramSchedule); else repository.update(deliveryZoneProgramSchedule); } }
DeliveryZoneProgramScheduleService { public void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule) { fillProgram(deliveryZoneProgramSchedule); fillDeliveryZone(deliveryZoneProgramSchedule); fillSchedule(deliveryZoneProgramSchedule); if (deliveryZoneProgramSchedule.getId() == null) repository.insert(deliveryZoneProgramSchedule); else repository.update(deliveryZoneProgramSchedule); }  }
DeliveryZoneProgramScheduleService { public void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule) { fillProgram(deliveryZoneProgramSchedule); fillDeliveryZone(deliveryZoneProgramSchedule); fillSchedule(deliveryZoneProgramSchedule); if (deliveryZoneProgramSchedule.getId() == null) repository.insert(deliveryZoneProgramSchedule); else repository.update(deliveryZoneProgramSchedule); }  void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule); DeliveryZoneProgramSchedule getByDeliveryZoneCodeAndProgramCode(String deliveryZoneCode, String programCode); List<Long> getProgramIdsForDeliveryZones(Long deliveryZoneId); List<ProcessingPeriod> getPeriodsForDeliveryZoneAndProgram(Long zoneId, Long programId); List<ProcessingPeriod> getPeriodsForDeliveryZoneAndProgram(Long zoneId, Long programId, Date finalPeriodBeginningDate); ProcessingSchedule getProcessingScheduleByZoneAndProgram(long zoneId, long programId); }
DeliveryZoneProgramScheduleService { public void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule) { fillProgram(deliveryZoneProgramSchedule); fillDeliveryZone(deliveryZoneProgramSchedule); fillSchedule(deliveryZoneProgramSchedule); if (deliveryZoneProgramSchedule.getId() == null) repository.insert(deliveryZoneProgramSchedule); else repository.update(deliveryZoneProgramSchedule); }  void save(DeliveryZoneProgramSchedule deliveryZoneProgramSchedule); DeliveryZoneProgramSchedule getByDeliveryZoneCodeAndProgramCode(String deliveryZoneCode, String programCode); List<Long> getProgramIdsForDeliveryZones(Long deliveryZoneId); List<ProcessingPeriod> getPeriodsForDeliveryZoneAndProgram(Long zoneId, Long programId); List<ProcessingPeriod> getPeriodsForDeliveryZoneAndProgram(Long zoneId, Long programId, Date finalPeriodBeginningDate); ProcessingSchedule getProcessingScheduleByZoneAndProgram(long zoneId, long programId);  }