@Test public void shouldReturnPeriodsStartingFromFirstPatientDataReportedExcludingCurrentWhenCurrentDateIsNotOpenToRequisitions() throws LMISException { DateTime firstReportedDate = calculateDateWithinRequisitionPeriod(); DateTime futureToday = calculateInvalidDateForRequisitionPeriodWithinTwelveMonths(firstReportedDate); LMISTestApp.getInstance().setCurrentTimeMillis(futureToday.getMillis()); malariaProgram.setReportedDate(firstReportedDate); malariaProgram.setCreatedAt(firstReportedDate.toDate()); when(malariaProgramRepository.getFirstMovement()).thenReturn(malariaProgram); List<Period> periods = patientDataService.calculatePeriods(VIAReportType.MALARIA); assertThat(periods.size(), is(monthsAfterInitialReportedDate)); }
public List<Period> calculatePeriods(VIAReportType VIAReportType) { List<Period> periods = new ArrayList<>(); if (VIAReportType.equals(MALARIA)) { calculateMalariaPeriods(periods); } else { calculatePTVPeriods(periods); } return periods; }
PatientDataService { public List<Period> calculatePeriods(VIAReportType VIAReportType) { List<Period> periods = new ArrayList<>(); if (VIAReportType.equals(MALARIA)) { calculateMalariaPeriods(periods); } else { calculatePTVPeriods(periods); } return periods; } }
PatientDataService { public List<Period> calculatePeriods(VIAReportType VIAReportType) { List<Period> periods = new ArrayList<>(); if (VIAReportType.equals(MALARIA)) { calculateMalariaPeriods(periods); } else { calculatePTVPeriods(periods); } return periods; }  }
PatientDataService { public List<Period> calculatePeriods(VIAReportType VIAReportType) { List<Period> periods = new ArrayList<>(); if (VIAReportType.equals(MALARIA)) { calculateMalariaPeriods(periods); } else { calculatePTVPeriods(periods); } return periods; }  List<Period> calculatePeriods(VIAReportType VIAReportType); List<StockCard> getMalariaProductsStockCards(); List<Long> getMalariaProductsStockHand(); Optional<MalariaProgram> save(MalariaProgram malariaProgram); MalariaProgram findForPeriod(DateTime beginDate, DateTime endDate); List<Product> getMalariaProducts(); }
PatientDataService { public List<Period> calculatePeriods(VIAReportType VIAReportType) { List<Period> periods = new ArrayList<>(); if (VIAReportType.equals(MALARIA)) { calculateMalariaPeriods(periods); } else { calculatePTVPeriods(periods); } return periods; }  List<Period> calculatePeriods(VIAReportType VIAReportType); List<StockCard> getMalariaProductsStockCards(); List<Long> getMalariaProductsStockHand(); Optional<MalariaProgram> save(MalariaProgram malariaProgram); MalariaProgram findForPeriod(DateTime beginDate, DateTime endDate); List<Product> getMalariaProducts();  }