DistrictFacadeEjb implements DistrictFacade { @Override public List<DistrictDto> getAllAfter(Date date) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<DistrictDto> cq = cb.createQuery(DistrictDto.class); Root<District> district = cq.from(District.class); selectDtoFields(cq, district); Predicate filter = districtService.createChangeDateFilter(cb, district, date); if (filter != null) { cq.where(filter); } return em.createQuery(cq).getResultList(); }  @Override List<DistrictReferenceDto> getAllActiveAsReference(); @Override List<DistrictReferenceDto> getAllActiveByRegion(String regionUuid); @Override List<DistrictDto> getAllAfter(Date date); @Override List<DistrictIndexDto> getIndexList(DistrictCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override long count(DistrictCriteria criteria); @Override List<String> getAllUuids(); @Override int getCountByRegion(String regionUuid); @Override DistrictDto getDistrictByUuid(String uuid); @Override List<DistrictDto> getByUuids(List<String> uuids); @Override DistrictReferenceDto getDistrictReferenceByUuid(String uuid); @Override DistrictReferenceDto getDistrictReferenceById(long id); @Override Map<String, String> getRegionUuidsForDistricts(List<DistrictReferenceDto> districts); @Override void saveDistrict(DistrictDto dto); @Override List<DistrictReferenceDto> getByName(String name, RegionReferenceDto regionRef, boolean includeArchivedEntities); @Override List<String> getNamesByIds(List<Long> districtIds); @Override void archive(String districtUuid); @Override void dearchive(String districtUuid); @Override boolean isUsedInOtherInfrastructureData(Collection<String> districtUuids); @Override boolean hasArchivedParentInfrastructure(Collection<String> districtUuids); static DistrictReferenceDto toReferenceDto(District entity); DistrictDto toDto(District entity); DistrictIndexDto toIndexDto(District entity); @Override String getFullEpidCodeForDistrict(String districtUuid); String getFullEpidCodeForDistrict(District district);  }
@Test public void testGetAllAfter() throws InterruptedException { Region region = creator.createRegion("region"); creator.createDistrict("district1", region); getDistrictService().doFlush(); Date date = new Date(); List<DistrictDto> results = getDistrictFacade().getAllAfter(date); assertEquals(0, results.size()); Thread.sleep(1); String districtName = "district2"; creator.createDistrict(districtName, region); results = getDistrictFacade().getAllAfter(date); assertEquals(1, results.size()); assertEquals(districtName, results.get(0).getName()); assertEquals(region.getUuid(), results.get(0).getRegion().getUuid()); }