ScoredClustersAllocationAlgorithmPreferenceForSmallHosts extends AllocationAlgorithmBase { @Override public List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clustersAvailableToStart) { List<ClusterResourcesAvailableToStart> sortedClustersAvailableToStart = cloneListOfClusters(clustersAvailableToStart); setClustersScore(sortedClustersAvailableToStart); sortClustersDownwardScore(sortedClustersAvailableToStart); return sortedClustersAvailableToStart; }  @Override List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clustersAvailableToStart); @Override List<HostResources> rankHostsToStart(List<HostResources> hostsResources);  }
@Test public void rankClustersToAllocationTest() { List<ClusterResourcesAvailableToStart> clustersAvailableToStart = createClustersWithScore(); Mockito.doReturn(clustersAvailableToStart).when(spyAlgorithm).cloneListOfClusters(clustersAvailableToStart); Mockito.doNothing().when(spyAlgorithm).setClustersScore(clustersAvailableToStart); Mockito.doNothing().when(spyAlgorithm).sortClustersDownwardScore(clustersAvailableToStart); spyAlgorithm.rankClustersToAllocation(clustersAvailableToStart); InOrder inOrder = Mockito.inOrder(spyAlgorithm); inOrder.verify(spyAlgorithm).cloneListOfClusters(clustersAvailableToStart); inOrder.verify(spyAlgorithm).setClustersScore(clustersAvailableToStart); inOrder.verify(spyAlgorithm).sortClustersDownwardScore(clustersAvailableToStart); }