CommunityFacadeEjb implements CommunityFacade { @Override public List<CommunityReferenceDto> getAllActiveByDistrict(String districtUuid) { District district = districtService.getByUuid(districtUuid); return district.getCommunities().stream().filter(c -> !c.isArchived()).map(f -> toReferenceDto(f)).collect(Collectors.toList()); }  @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 testGetAllActiveByDistrict() { Region r = creator.createRegion("r"); District d = creator.createDistrict("d", r); creator.createCommunity("c1", d); Community c2 = creator.createCommunity("c2", d); getCommunityFacade().archive(c2.getUuid()); assertEquals(1, getCommunityFacade().getAllActiveByDistrict(d.getUuid()).size()); }