ScoredClustersAllocationAlgorithmPreferenceForSmallHosts extends AllocationAlgorithmBase { @Override public List<HostResources> rankHostsToStart(List<HostResources> hostsResources) { List<HostResources> sortedHosts = cloneListOfHosts(hostsResources); setEachHostScore(sortedHosts); sortHosts(sortedHosts); return sortedHosts; }  @Override List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clustersAvailableToStart); @Override List<HostResources> rankHostsToStart(List<HostResources> hostsResources);  }
@Test public void rankHostsToStartTest() { List<HostResources> hosts = createHostsWithScore(); Mockito.doReturn(hosts).when(spyAlgorithm).cloneListOfHosts(hosts); Mockito.doReturn(hosts).when(spyAlgorithm).setEachHostScore(hosts); Mockito.doNothing().when(spyAlgorithm).sortHosts(hosts); spyAlgorithm.rankHostsToStart(hosts); InOrder inOrder = Mockito.inOrder(spyAlgorithm); inOrder.verify(spyAlgorithm).cloneListOfHosts(hosts); inOrder.verify(spyAlgorithm).setEachHostScore(hosts); inOrder.verify(spyAlgorithm).sortHosts(hosts); }