PTVProgramBuilder { public PTVProgram buildInitialPTVProgram(Period period) throws LMISException { PTVProgram ptvProgram = new PTVProgram(); ptvProgram.setStartPeriod(period.getBegin().toDate()); ptvProgram.setEndPeriod(period.getEnd().toDate()); ptvProgram.setStatus(ViaReportStatus.MISSING); ptvProgram.setCreatedBy(EMPTY_STRING); ptvProgram.setVerifiedBy(EMPTY_STRING); List<PatientDispensation> patientDispensations = patientDispensationBuilder.buildInitialPatientDispensations(ptvProgram); ptvProgram.setPatientDispensations(patientDispensations); List<PTVProgramStockInformation> ptvProgramStocksInformation = ptvProgramStockInformationBuilder.buildPTVProgramStockInformation(ptvProgram); ptvProgram.setPtvProgramStocksInformation(ptvProgramStocksInformation); return ptvProgram; }  PTVProgram buildInitialPTVProgram(Period period); PTVProgram buildExistentPTVProgram(PTVProgram ptvProgram); static final String EMPTY_STRING; }
@Test public void shouldCreatePTVProgramForCurrentPeriod() throws LMISException { Period period = new Period(DateTime.now()); PTVProgram expectedPTVProgram = new PTVProgram(); expectedPTVProgram.setStartPeriod(period.getBegin().toDate()); expectedPTVProgram.setEndPeriod(period.getEnd().toDate()); expectedPTVProgram.setStatus(ViaReportStatus.MISSING); expectedPTVProgram.setCreatedBy(""); expectedPTVProgram.setVerifiedBy(""); List<PatientDispensation> patientDispensations = patientDispensationBuilder.buildInitialPatientDispensations(expectedPTVProgram); expectedPTVProgram.setPatientDispensations(patientDispensations); when(ptvProgramStockInformationBuilder.buildPTVProgramStockInformation(expectedPTVProgram)).thenReturn(new ArrayList<PTVProgramStockInformation>()); List<PTVProgramStockInformation> ptvProgramStocksInformation = ptvProgramStockInformationBuilder.buildPTVProgramStockInformation(expectedPTVProgram); expectedPTVProgram.setPtvProgramStocksInformation(ptvProgramStocksInformation); PTVProgram actualPTVProgram = ptvProgramBuilder.buildInitialPTVProgram(period); assertEquals(actualPTVProgram, expectedPTVProgram); }