AutonomiccsSystemVmDeploymentService implements InitializingBean { protected LinkedHashMap<Network, List<? extends NicProfile>> getSystemVmNetworks(HostVO host, DataCenterDeployment plan, Account systemAcct) { LinkedHashMap<Network, List<? extends NicProfile>> networks = new LinkedHashMap<>(); NicProfile defaultNic = createDefaultNic(); NetworkVO defaultNetwork = getDefaultNetwork(host.getDataCenterId()); networks.put(networkManager.setupNetwork(systemAcct, networkOfferingDao.findById(defaultNetwork.getNetworkOfferingId()), plan, null, null, false).get(0), new ArrayList<NicProfile>(Arrays.asList(defaultNic))); List<? extends NetworkOffering> offerings = networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork, NetworkOffering.SystemManagementNetwork); for (NetworkOffering offering : offerings) { networks.put(networkManager.setupNetwork(systemAcct, offering, plan, null, null, false).get(0), new ArrayList<NicProfile>()); } return networks; }  HostVO searchForRandomHostInCloudToDeployAutonomiccsSystemVm(); HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod); HostVO searchForAnotherRandomHostToStartSystemVm(VMInstanceVO vmInstance); AutonomiccsSystemVm deploySystemVmWithJava(Long hostId, SystemVmType systemVmType); @Override void afterPropertiesSet();  }
@Test public void getSystemVmNetworksTest() { List<NetworkOffering> offerings = new ArrayList<>(); NetworkOffering offering = Mockito.mock(NetworkOfferingVO.class); offerings.add(offering); Network net2 = Mockito.mock(Network.class); List<Network> nets2 = new ArrayList<>(); nets2.add(net2); String stringNull = null; Mockito.doReturn(nets2).when(networkManager).setupNetwork(Mockito.any(Account.class), Mockito.eq(offering), Mockito.any(DataCenterDeployment.class), Mockito.eq(stringNull), Mockito.eq(stringNull), Mockito.eq(false)); executeGetSystemVmNetworksTest(offerings, 2); Mockito.verify(networkManager).setupNetwork(Mockito.any(Account.class), Mockito.eq(offering), Mockito.any(DataCenterDeployment.class), Mockito.eq(stringNull), Mockito.eq(stringNull), Mockito.eq(false)); }