AutonomiccsSystemVmDeploymentService implements InitializingBean { public HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod) { List<ClusterVO> allClustersFromPod = clusterService.listAllClustersFromPod(pod.getId()); Collections.shuffle(allClustersFromPod); for (ClusterVO c : allClustersFromPod) { HostVO host = searchForRandomHostInClusterToDeployAutonomiccsSystemVm(c); if (host != null) { return host; } } logger.info(String.format("Could not find any suitable hosts to deploy the system VM into pod [podId=%d, podName=%s]", pod.getId(), pod.getName())); return null; }  HostVO searchForRandomHostInCloudToDeployAutonomiccsSystemVm(); HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod); HostVO searchForAnotherRandomHostToStartSystemVm(VMInstanceVO vmInstance); AutonomiccsSystemVm deploySystemVmWithJava(Long hostId, SystemVmType systemVmType); @Override void afterPropertiesSet();  }
@Test @PrepareForTest(AutonomiccsSystemVmDeploymentService.class) public void searchForRandomHostInPodToDeployAutonomiccsSystemVmTest() { List<ClusterVO> allClustersFromPod = configureAllClustersFromPod(); HostVO host = Mockito.mock(HostVO.class); configureExecuteVerifySearchForRandomHostInPodToDeployAutonomiccsSystemVmTest(allClustersFromPod, host, host, 1); }