Environment { public Set<String> getFederatedNetworks() { Set<String> nets = new HashSet<String>(); Map<String, Set<String>> map = getNetworksRegion(); Iterator<Entry<String, Set<String>>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, Set<String>> d = iterator.next(); if (d.getValue().size() > 1) { nets.add(d.getKey()); } } return nets; } Environment();  Environment(String name, Set<Tier> tiers);  Environment(String name, Set<Tier> tiers, String description, String org, String vdc);  Environment(String name, String description, Set<Tier> tiers); void addTier(Tier tier); void deleteTier(Tier tier); void updateTier(Tier tierOld, Tier tierNew); @Override boolean equals(Object obj); String getDescription(); Long getId(); String getName(); String getOrg(); String getOvf(); Set<Tier> getTiers(); String getVdc(); @Override int hashCode(); void setDescription(String description); void setId(Long id); void setName(String name); void setOrg(String org); void setOvf(String ovf); void setTiers(Set<Tier> tiers); void setVdc(String vdc); EnvironmentDto toDto(); Map<String, Set<String>> getNetworksRegion(); Set<String> getFederatedNetworks(); boolean isDifferentRegions(); boolean isNetworkFederated(); Network getNetworkWithRegionAndName(String region, String networkName); String toString(); static final String ORG_FIELD; static final String VDC_FIELD; static final String ENVIRONMENT_NAME_FIELD; static final int COLUMN_LENGHT; static final int LONG_COLUMN_LENGHT; }
@Test public void testgetRegionNetworks() { ProductRelease productRelease = new ProductRelease("product", "2.0"); List<ProductRelease> productReleases = new ArrayList<ProductRelease>(); productReleases.add(productRelease); Tier tier = new Tier("name1", new Integer(1), new Integer(5), new Integer(1), productReleases); tier.setRegion("region1"); tier.addNetwork(new Network("uno2", VDC, REGION)); Tier tier3 = new Tier("name3", new Integer(1), new Integer(5), new Integer(1), productReleases); tier3.setRegion("region3"); tier3.addNetwork(new Network("uno2", VDC, REGION)); Tier tier2 = new Tier("name2", new Integer(1), new Integer(5), new Integer(1), productReleases); tier2.setRegion("region2"); tier2.addNetwork(new Network("uno", VDC, REGION)); Tier tier4 = new Tier("name5", new Integer(1), new Integer(5), new Integer(1), productReleases); tier4.setRegion("region2"); tier4.addNetwork(new Network("uno2", VDC, REGION)); Set<Tier> tiers = new HashSet<Tier>(); tiers.add(tier); tiers.add(tier2); tiers.add(tier3); tiers.add(tier4); Environment envResult = new Environment("environemntName", tiers); Set<String> nets = envResult.getFederatedNetworks(); assertEquals(nets.size(), 1); }