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