ScoredClustersAllocationAlgorithmPreferenceForSmallHosts extends AllocationAlgorithmBase { protected long calculateClusterScore(ClusterResources cluster) { long clusterCpu = cluster.getCpus() * cluster.getCpuSpeed(); long clusterMemory = cluster.getMemoryInBytes(); return clusterCpu * clusterMemory; }  @Override List<ClusterResourcesAvailableToStart> rankClustersToAllocation(List<ClusterResourcesAvailableToStart> clustersAvailableToStart); @Override List<HostResources> rankHostsToStart(List<HostResources> hostsResources);  }
@Test public void calculateClusterScoreTest() { ClusterResources cluster = Mockito.mock(ClusterResources.class); Mockito.when(cluster.getCpus()).thenReturn(2); Mockito.when(cluster.getCpuSpeed()).thenReturn(2000l); Mockito.when(cluster.getMemoryInBytes()).thenReturn(4000l); long restult = spyAlgorithm.calculateClusterScore(cluster); Assert.assertEquals(16000000, restult, 0l); }