DistrictFacadeEjb implements DistrictFacade { @Override public List<DistrictReferenceDto> getAllActiveByRegion(String regionUuid) { Region region = regionService.getByUuid(regionUuid); return region.getDistricts().stream().filter(d -> !d.isArchived()).map(f -> toReferenceDto(f)).collect(Collectors.toList()); }  @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 testGetAllActiveByRegion() { Region r = creator.createRegion("r"); creator.createDistrict("d1", r); District d2 = creator.createDistrict("d2", r); getDistrictFacade().archive(d2.getUuid()); assertEquals(1, getDistrictFacade().getAllActiveByRegion(r.getUuid()).size()); }