### Question:
VirtualNetworkFilter implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener { @Override public void deleteNetwork(String guid) { String name = null; if (nameToGuid.isEmpty()) { log.warn("Could not delete network with ID {}, network doesn't exist", guid); return; } for (Entry<String, String> entry : nameToGuid.entrySet()) { if (entry.getValue().equals(guid)) { name = entry.getKey(); break; } log.warn("Could not delete network with ID {}, network doesn't exist", guid); } if (log.isDebugEnabled()) log.debug("Deleting network with name {} ID {}", name, guid); nameToGuid.remove(name); deleteGateway(guid); if(vNetsByGuid.get(guid)!=null){ vNetsByGuid.get(guid).clearHosts(); vNetsByGuid.remove(guid); } Collection<MACAddress> deleteList = new ArrayList<MACAddress>(); for (MACAddress host : macToGuid.keySet()) { if (macToGuid.get(host).equals(guid)) { deleteList.add(host); } } for (MACAddress mac : deleteList) { if (log.isDebugEnabled()) { log.debug("Removing host {} from network {}", HexString.toHexString(mac.toBytes()), guid); } macToGuid.remove(mac); for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { portToMac.remove(entry.getKey()); break; } } } }  @Override void createNetwork(String guid, String network, Integer gateway); @Override void deleteNetwork(String guid); @Override void addHost(MACAddress mac, String guid, String port); @Override void deleteHost(MACAddress mac, String port); @Override Collection<Class<? extends IFloodlightService>> getModuleServices(); @Override Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls(); @Override Collection<Class<? extends IFloodlightService>> getModuleDependencies(); @Override void init(FloodlightModuleContext context); @Override void startUp(FloodlightModuleContext context); @Override String getName(); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx); @Override Collection <VirtualNetwork> listNetworks();  }### Answer:
@Test public void testDeleteNetwork() { testModifyNetwork(); vns.deleteNetwork(guid2); assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid1)); assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid3)); assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).size() == 2); assertFalse(vns.nameToGuid.containsKey(net2)); assertFalse(vns.guidToGateway.containsKey(net2)); assertTrue(vns.vNetsByGuid.get(guid2)==null); }