ScoredClustersAllocationAlgorithmPreferenceForSmallHosts extends AllocationAlgorithmBase { protected void sortClustersDownwardScore(List<ClusterResourcesAvailableToStart> clusters) { Collections.sort(clusters, reversedComparator); }  @Override List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clustersAvailableToStart); @Override List<HostResources> rankHostsToStart(List<HostResources> hostsResources);  }
@Test public void sortClustersDownwardScoreTest() { List<ClusterResourcesAvailableToStart> clusters = createClustersWithScore(); spyAlgorithm.sortClustersDownwardScore(clusters); Assert.assertEquals(4.0, clusters.get(0).getScore(), 0); Assert.assertEquals(3.0, clusters.get(1).getScore(), 0); Assert.assertEquals(2.0, clusters.get(2).getScore(), 0); Assert.assertEquals(1.0, clusters.get(3).getScore(), 0); }