AutonomiccsSystemVmDeploymentService implements InitializingBean { protected HostVO searchForRandomHostInClusterToDeployAutonomiccsSystemVm(ClusterVO c) { return searchForAnotherRandomHostInTheClusterToStartSystemVmExcludingHosts(c, new ArrayList<HostVO>()); }  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 searchForRandomHostInClusterToDeployAutonomiccsSystemVmTest() { ClusterVO cluster = Mockito.mock(ClusterVO.class); HostVO host = Mockito.mock(HostVO.class); Mockito.doReturn(host).when(spy).searchForAnotherRandomHostInTheClusterToStartSystemVmExcludingHosts(Mockito.any(ClusterVO.class), Matchers.anyListOf(HostVO.class)); HostVO result = spy.searchForRandomHostInClusterToDeployAutonomiccsSystemVm(cluster); Mockito.verify(spy).searchForAnotherRandomHostInTheClusterToStartSystemVmExcludingHosts(Mockito.any(ClusterVO.class), Matchers.anyListOf(HostVO.class)); Assert.assertEquals(host, result); }