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