RegionFacadeEjb implements RegionFacade { @Override public List<RegionDto> getAllAfter(Date date) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<RegionDto> cq = cb.createQuery(RegionDto.class); Root<Region> region = cq.from(Region.class); selectDtoFields(cq, region); Predicate filter = regionService.createChangeDateFilter(cb, region, date); if (filter != null) { cq.where(filter); } return em.createQuery(cq).getResultList(); }  @Override List<RegionReferenceDto> getAllActiveByArea(String areaUuid); @Override List<RegionReferenceDto> getAllActiveAsReference(); @Override List<RegionDto> getAllAfter(Date date); @Override List<RegionIndexDto> getIndexList(RegionCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override long count(RegionCriteria criteria); @Override List<String> getAllUuids(); @Override RegionDto getRegionByUuid(String uuid); @Override List<RegionDto> getByUuids(List<String> uuids); @Override RegionReferenceDto getRegionReferenceByUuid(String uuid); @Override RegionReferenceDto getRegionReferenceById(int id); @Override List<String> getNamesByIds(List<Long> regionIds); @Override void archive(String regionUuid); @Override void dearchive(String regionUuid); @Override boolean isUsedInOtherInfrastructureData(Collection<String> regionUuids); static RegionReferenceDto toReferenceDto(Region entity); RegionDto toDto(Region entity); RegionIndexDto toIndexDto(Region entity); @Override void saveRegion(RegionDto dto); @Override List<RegionReferenceDto> getByName(String name, boolean includeArchivedEntities);  }
@Test public void testGetAllAfter() throws InterruptedException { creator.createRegion("region1"); getRegionService().doFlush(); Date date = new Date(); List<RegionDto> results = getRegionFacade().getAllAfter(date); assertEquals(0, results.size()); Thread.sleep(1); String regionName = "region2"; creator.createRegion(regionName); results = getRegionFacade().getAllAfter(date); assertEquals(1, results.size()); assertEquals(regionName, results.get(0).getName()); }