Network { public Set<SubNetwork> cloneSubNets() { Set<SubNetwork> subNetAux = new HashSet<SubNetwork>(); for (SubNetwork subNet2 : getSubNets()) { subNetAux.add(subNet2); } return subNetAux; } Network();  Network(String name, String vdc, String region); void addSubNet(SubNetwork subNet); Set<SubNetwork> cloneSubNets(); void deleteSubNet(SubNetwork subNet); void updateSubNet(SubNetwork subNet); boolean contains(SubNetwork subNet); String getNetworkName(); String getRegion(); void setNetworkName(String name); String getVdc(); void setVdc(String vdc); void setFederatedNetwork(boolean federatedNetwork); boolean getfederatedNetwork(); void setFederatedRange(String range); String getFederatedRange(); Set<SubNetwork> getSubNets(); void setSubNets(Set<SubNetwork> subNets); NetworkDto toDto(); NetworkInstance toNetworkInstance(); @Override boolean equals(Object obj); @Override int hashCode(); String toString();  }
@Test public void testCloneSubNets() throws Exception { Network network = new Network(); SubNetwork subnet = new SubNetwork(SUBNETWORK_NAME, VDC, REGION); network.addSubNet(subnet); Set<SubNetwork> subNets = network.cloneSubNets(); assertEquals(subNets.size(), 1); for (SubNetwork subNet : subNets) { assertEquals(subNet.getName(), SUBNETWORK_NAME); } }