@Test public void shouldGeneratePeriodWithPreviousRnrEndDateAsBeginAndNextMonthAsEndDate() throws Exception { RnRForm previousRnrForm = new RnRForm(); previousRnrForm.setProgram(programMMIA); previousRnrForm.setPeriodEnd(DateUtil.parseString("2020-10-18", DateUtil.DB_DATE_FORMAT)); DateTime dateTime = new DateTime(previousRnrForm.getPeriodEnd()).plusMonths(1); DateTime expectedPeriodEnd = DateUtil.cutTimeStamp(dateTime.withDate(dateTime.getYear(), dateTime.getMonthOfYear(), Period.END_DAY)); when(mockRnrFormRepository.listInclude(any(), anyString(), any(ReportTypeForm.class))).thenReturn(newArrayList(previousRnrForm)); Period period = requisitionPeriodService.generateNextPeriod(programMMIA.getProgramCode(), null); assertThat(period.getBegin().toDate(), is(previousRnrForm.getPeriodEnd())); assertThat(new DateTime(period.getEnd()).getMonthOfYear(), is(11)); assertThat(period.getEnd(), is(expectedPeriodEnd)); }
public Period generateNextPeriod(String programCode, Date physicalInventoryDate) throws LMISException { return generateNextPeriod(programCode, physicalInventoryDate, reportTypeFormRepository.getReportType(programCode)); }
RequisitionPeriodService { public Period generateNextPeriod(String programCode, Date physicalInventoryDate) throws LMISException { return generateNextPeriod(programCode, physicalInventoryDate, reportTypeFormRepository.getReportType(programCode)); } }
RequisitionPeriodService { public Period generateNextPeriod(String programCode, Date physicalInventoryDate) throws LMISException { return generateNextPeriod(programCode, physicalInventoryDate, reportTypeFormRepository.getReportType(programCode)); }  }
RequisitionPeriodService { public Period generateNextPeriod(String programCode, Date physicalInventoryDate) throws LMISException { return generateNextPeriod(programCode, physicalInventoryDate, reportTypeFormRepository.getReportType(programCode)); }  Period generateNextPeriod(String programCode, Date physicalInventoryDate); Period generateNextPeriod(String programCode, Date physicalInventoryDate, ReportTypeForm typeForm); Period generateNextPeriod(List<RnRForm> rnRForms, String programCode, Date physicalInventoryDate); boolean hasMissedPeriod(String programCode); boolean hasMissedPeriod(String programCode, ReportTypeForm reportTypeForm); int getMissedPeriodOffsetMonth(String programCode); int getMissedPeriodOffsetMonth(String programCode, ReportTypeForm typeForm); int getIncompletePeriodOffsetMonth(String programCode); DateTime getCurrentMonthInventoryBeginDate(); }
RequisitionPeriodService { public Period generateNextPeriod(String programCode, Date physicalInventoryDate) throws LMISException { return generateNextPeriod(programCode, physicalInventoryDate, reportTypeFormRepository.getReportType(programCode)); }  Period generateNextPeriod(String programCode, Date physicalInventoryDate); Period generateNextPeriod(String programCode, Date physicalInventoryDate, ReportTypeForm typeForm); Period generateNextPeriod(List<RnRForm> rnRForms, String programCode, Date physicalInventoryDate); boolean hasMissedPeriod(String programCode); boolean hasMissedPeriod(String programCode, ReportTypeForm reportTypeForm); int getMissedPeriodOffsetMonth(String programCode); int getMissedPeriodOffsetMonth(String programCode, ReportTypeForm typeForm); int getIncompletePeriodOffsetMonth(String programCode); DateTime getCurrentMonthInventoryBeginDate();  }