ClusterManagementDummyAlgorithm implements ClusterAdministrationHeuristicAlgorithm { protected List<VmResources> cloneHostVmsList(HostResources host) { return new ArrayList<>(host.getVmsResources()); }  @Override int getClusterIntervalBetweenConsolidation(); @Override List<HostResources> rankHosts(List<HostResources> hosts); @Override Map<Long, HostResources> mapVMsToHost(List<HostResources> rankedHosts); @Override List<HostResources> rankHostToPowerOff(List<HostResources> idleHosts); @Override boolean canPowerOffHost(HostResources hostToPowerOff, CloudResources cloudResources); @Override boolean canPowerOffAnotherHostInCloud(CloudResources cloudResources); @Override boolean canHeuristicShutdownHosts();  }
@Test public void cloneHostVmsListTest() { HostResources host = Mockito.mock(HostResources.class); List<VmResources> vms = new ArrayList<VmResources>(); VmResources vm = Mockito.mock(VmResources.class); vms.add(vm); Mockito.when(host.getVmsResources()).thenReturn(vms); List<VmResources> result = spyAlgorithm.cloneHostVmsList(host); Assert.assertNotNull(result); Assert.assertEquals(vms.size(), result.size()); Assert.assertEquals(vms, result); Assert.assertEquals(vm, result.get(0)); Assert.assertFalse(vms == result); }