AllocationAlgorithmBase implements AllocationAlgorithm { @SuppressWarnings("unchecked") protected List<HostResources> cloneListOfHosts(List<HostResources> hosts) { return (List<HostResources>) ((ArrayList<HostResources>) hosts).clone(); }  @Override List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clusters); @Override boolean needsToActivateHost(CloudResources cloudCapacity); @Override List<HostResources> rankHostsToStart(List<HostResources> hostsResources);  }
@Test public void cloneListOfHostsTest() { List<HostResources> hosts = new ArrayList<HostResources>(); HostResources host = Mockito.mock(HostResources.class); hosts.add(host); List<HostResources> clonedHosts = spyAlgorithm.cloneListOfHosts(hosts); Assert.assertNotNull(clonedHosts); Assert.assertEquals(1, clonedHosts.size()); Assert.assertEquals(hosts, clonedHosts); Assert.assertEquals(host, clonedHosts.get(0)); }