ServiceDispensationBuilder { public List<ServiceDispensation> buildInitialServiceDispensations(PTVProgramStockInformation ptvProgramStockInformation) throws LMISException { List<ServiceDispensation> serviceDispensations = new ArrayList<>(); for (HealthFacilityService healthFacilityService : getAllHealthFacilityServices()) { ServiceDispensation serviceDispensation = new ServiceDispensation(); serviceDispensation.setHealthFacilityService(healthFacilityService); serviceDispensation.setPtvProgramStockInformation(ptvProgramStockInformation); serviceDispensations.add(serviceDispensation); } return serviceDispensations; } @Inject  ServiceDispensationBuilder(); List<ServiceDispensation> buildInitialServiceDispensations(PTVProgramStockInformation ptvProgramStockInformation); List<ServiceDispensation> buildExistentInitialServiceDispensations(PTVProgramStockInformation ptvProgramStockInformation);  }
@Test public void shouldReturnServiceDispensationsForAPTVProgramStockInformation() throws Exception { ArrayList<HealthFacilityService> expectedHealthFacilityServices = PTVUtil.createDummyHealthFacilityServices(); when(healthFacilityServiceRepository.getAll()).thenReturn(expectedHealthFacilityServices); PTVProgramStockInformation ptvProgramStockInformation = new PTVProgramStockInformation(); ptvProgramStockInformation.setId(10L); List<ServiceDispensation> serviceDispensations = serviceDispensationBuilder.buildInitialServiceDispensations(ptvProgramStockInformation); assertThat(serviceDispensations.size(), is(expectedHealthFacilityServices.size())); for (ServiceDispensation serviceDispensation : serviceDispensations) { assertThat(serviceDispensation.getPtvProgramStockInformation(), is(ptvProgramStockInformation)); } }