PopulationDataFacadeEjb implements PopulationDataFacade { @Override public Integer getProjectedRegionPopulation(String regionUuid) { Float growthRate = regionService.getByUuid(regionUuid).getGrowthRate(); if (growthRate == null || growthRate == 0) { return getRegionPopulation(regionUuid); } CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<PopulationData> cq = cb.createQuery(PopulationData.class); Root<PopulationData> root = cq.from(PopulationData.class); PopulationDataCriteria criteria = new PopulationDataCriteria().ageGroupIsNull(true).sexIsNull(true).districtIsNull(true).region(new RegionReferenceDto(regionUuid)); Predicate filter = service.buildCriteriaFilter(criteria, cb, root); cq.where(filter); try { PopulationData populationData = em.createQuery(cq).getSingleResult(); return InfrastructureHelper.getProjectedPopulation(populationData.getPopulation(), populationData.getCollectionDate(), growthRate); } catch (NoResultException | NonUniqueResultException e) { return null; } }  @Override Integer getRegionPopulation(String regionUuid); @Override Integer getProjectedRegionPopulation(String regionUuid); @Override Integer getDistrictPopulation(String districtUuid); @Override Integer getProjectedDistrictPopulation(String districtUuid); @Override void savePopulationData(List<PopulationDataDto> populationDataList); @Override List<PopulationDataDto> getPopulationData(PopulationDataCriteria criteria); @SuppressWarnings("unchecked") @Override List<Object[]> getPopulationDataForExport(); @SuppressWarnings("unchecked") @Override List<Long> getMissingPopulationDataForStatistics(
		StatisticsCaseCriteria criteria,
		boolean groupByRegion,
		boolean groupByDistrict,
		boolean groupBySex,
		boolean groupByAgeGroup); PopulationData fromDto(@NotNull PopulationDataDto source); static PopulationDataDto toDto(PopulationData source);  }
@Test public void testGetProjectedRegionPopulation() { RDCFEntities rdcf = creator.createRDCFEntities("Region", "District", "Community", "Facility"); RegionDto region = getRegionFacade().getRegionByUuid(rdcf.region.getUuid()); region.setGrowthRate(2.7f); getRegionFacade().saveRegion(region); creator.createPopulationData(new RegionReferenceDto(rdcf.region.getUuid()), null, 450000, DateHelper.subtractYears(new Date(), 3)); assertEquals(new Integer(487440), getPopulationDataFacade().getProjectedRegionPopulation(rdcf.region.getUuid())); }