Network { public void addSubNet(SubNetwork subNet) { if (subNets == null) { subNets = new HashSet<SubNetwork>(); } subNets.add(subNet); } 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 testCreateSubNetworkInstance() throws Exception { NetworkInstance network = new NetworkInstance(NETWORK_NAME, VDC, REGION); network.setIdNetwork(ID); SubNetworkInstance subNetwork = new SubNetworkInstance(SUBNETWORK_NAME, VDC, REGION); subNetwork.setIdSubNet(ID); network.addSubNet(subNetwork); assertEquals(subNetwork.toJson(), SUBNETWORK_STRING); assertEquals(network.toAddInterfaceJson(), ADDINTERFACE); }
@Test public void testCreateRouter() throws Exception { NetworkInstance network = new NetworkInstance(NETWORK_NAME, VDC, REGION); network.setIdNetwork(ID); SubNetworkInstance subNetwork = new SubNetworkInstance(SUBNETWORK_NAME, VDC, REGION); subNetwork.setIdSubNet(ID); network.addSubNet(subNetwork); RouterInstance router = new RouterInstance(ID, ROUTER_NAME); router.setIdRouter(ID); network.addRouter(router); assertEquals(router.toJson(), ROUTER_STRING); assertEquals(network.toAddInterfaceJson(), ADDINTERFACE); }