CommunityFacadeEjb implements CommunityFacade { @Override public List<CommunityDto> getAllAfter(Date date) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<CommunityDto> cq = cb.createQuery(CommunityDto.class); Root<Community> community = cq.from(Community.class); selectDtoFields(cq, community); Predicate filter = communityService.createChangeDateFilter(cb, community, date); if (filter != null) { cq.where(filter); } return em.createQuery(cq).getResultList(); }  @Override List<CommunityReferenceDto> getAllActiveByDistrict(String districtUuid); @Override List<CommunityDto> getAllAfter(Date date); @Override void archive(String communityUuid); @Override void dearchive(String communityUuid); @Override List<CommunityDto> getIndexList(CommunityCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override long count(CommunityCriteria criteria); @Override List<String> getAllUuids(); @Override CommunityDto getByUuid(String uuid); @Override List<CommunityDto> getByUuids(List<String> uuids); @Override CommunityReferenceDto getCommunityReferenceByUuid(String uuid); @Override CommunityReferenceDto getCommunityReferenceById(long id); @Override Map<String, String> getDistrictUuidsForCommunities(List<CommunityReferenceDto> communities); @Override void saveCommunity(CommunityDto dto); @Override List<CommunityReferenceDto> getByName(String name, DistrictReferenceDto districtRef, boolean includeArchivedEntities); @Override boolean isUsedInOtherInfrastructureData(Collection<String> communityUuids); @Override boolean hasArchivedParentInfrastructure(Collection<String> communityUuids); static CommunityReferenceDto toReferenceDto(Community entity);  }
@Test public void testGetAllAfter() throws InterruptedException { Region region = creator.createRegion("region"); District district = creator.createDistrict("district", region); creator.createCommunity("community1", district); getCommunityService().doFlush(); Date date = new Date(); List<CommunityDto> results = getCommunityFacade().getAllAfter(date); assertEquals(0, results.size()); Thread.sleep(1); String communityName = "community2"; creator.createCommunity(communityName, district); results = getCommunityFacade().getAllAfter(date); assertEquals(1, results.size()); assertEquals(communityName, results.get(0).getName()); assertEquals(district.getUuid(), results.get(0).getDistrict().getUuid()); assertEquals(region.getUuid(), results.get(0).getRegion().getUuid()); }