@Test public void shouldGetAllPeriodsAfterAGivenDateAndPeriod() throws Exception { Long scheduleId = 1L; Long startingPeriodId = 10L; DateTime currentDate = new DateTime(); Date programStartDate = currentDate.minusMonths(1).toDate(); List<ProcessingPeriod> processingPeriods = Arrays.asList(new ProcessingPeriod()); when(mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startingPeriodId, programStartDate, currentDate.toDate())).thenReturn(processingPeriods); List<ProcessingPeriod> periodList = repository.getAllPeriodsAfterDateAndPeriod(scheduleId, startingPeriodId, programStartDate, currentDate.toDate()); assertThat(periodList, is(processingPeriods)); }
public List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate) { return startPeriodId == null ? mapper.getAllPeriodsAfterDate(scheduleId, afterDate, beforeDate) : mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startPeriodId, afterDate, beforeDate); }
ProcessingPeriodRepository { public List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate) { return startPeriodId == null ? mapper.getAllPeriodsAfterDate(scheduleId, afterDate, beforeDate) : mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startPeriodId, afterDate, beforeDate); } }
ProcessingPeriodRepository { public List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate) { return startPeriodId == null ? mapper.getAllPeriodsAfterDate(scheduleId, afterDate, beforeDate) : mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startPeriodId, afterDate, beforeDate); } @Autowired  ProcessingPeriodRepository(ProcessingPeriodMapper processingPeriodMapper); }
ProcessingPeriodRepository { public List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate) { return startPeriodId == null ? mapper.getAllPeriodsAfterDate(scheduleId, afterDate, beforeDate) : mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startPeriodId, afterDate, beforeDate); } @Autowired  ProcessingPeriodRepository(ProcessingPeriodMapper processingPeriodMapper); List<ProcessingPeriod> getAll(Long scheduleId); void insert(ProcessingPeriod processingPeriod); void delete(Long processingPeriodId); List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate); List<ProcessingPeriod> getOpenPeriods(Long facilityId, Long programId, Long startingPeriodId); ProcessingPeriod getById(Long id); List<ProcessingPeriod> getAllPeriodsForDateRange(Long scheduleId, Date startDate, Date endDate); List<ProcessingPeriod> getRnrPeriodsForDateRange(Long facilityId, Long programId, Date startDate, Date endDate); List<ProcessingPeriod> getAllPeriodsBefore(Long scheduleId, Date beforeDate); ProcessingPeriod getCurrentPeriod(Long scheduleId, Date programStartDate); List<ProcessingPeriod> getNPreviousPeriods(ProcessingPeriod currentPeriod, Integer n); ProcessingPeriod getPeriodForDate(Long scheduleId, Date date); List<ProcessingPeriod> getAllPeriodsForScheduleAndYear(Long scheduleId, Long year); }
ProcessingPeriodRepository { public List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate) { return startPeriodId == null ? mapper.getAllPeriodsAfterDate(scheduleId, afterDate, beforeDate) : mapper.getAllPeriodsAfterDateAndPeriod(scheduleId, startPeriodId, afterDate, beforeDate); } @Autowired  ProcessingPeriodRepository(ProcessingPeriodMapper processingPeriodMapper); List<ProcessingPeriod> getAll(Long scheduleId); void insert(ProcessingPeriod processingPeriod); void delete(Long processingPeriodId); List<ProcessingPeriod> getAllPeriodsAfterDateAndPeriod(Long scheduleId, Long startPeriodId, Date afterDate, Date beforeDate); List<ProcessingPeriod> getOpenPeriods(Long facilityId, Long programId, Long startingPeriodId); ProcessingPeriod getById(Long id); List<ProcessingPeriod> getAllPeriodsForDateRange(Long scheduleId, Date startDate, Date endDate); List<ProcessingPeriod> getRnrPeriodsForDateRange(Long facilityId, Long programId, Date startDate, Date endDate); List<ProcessingPeriod> getAllPeriodsBefore(Long scheduleId, Date beforeDate); ProcessingPeriod getCurrentPeriod(Long scheduleId, Date programStartDate); List<ProcessingPeriod> getNPreviousPeriods(ProcessingPeriod currentPeriod, Integer n); ProcessingPeriod getPeriodForDate(Long scheduleId, Date date); List<ProcessingPeriod> getAllPeriodsForScheduleAndYear(Long scheduleId, Long year);  }