ClusterResourcesService { public ClusterResourcesAvailableToStart createClusterResourcesAvailableToStart(long clusterId, String clusterName, List<HostResources> hostsToStart) { long clusterCpuSpeed = 0, clusterMemory = 0; int clusterCpus = 0; for (HostResources currentHost : hostsToStart) { clusterMemory += currentHost.getTotalMemoryInBytes(); clusterCpuSpeed += currentHost.getSpeed(); clusterCpus += currentHost.getCpus(); } return new ClusterResourcesAvailableToStart(clusterId, clusterName, clusterCpuSpeed, clusterCpus, clusterMemory, hostsToStart); }  ClusterResourcesUp createClusterResourcesUp(long clusterId, String clusterName, List<HostResources> hostsResources); ClusterResourcesAvailableToStart createClusterResourcesAvailableToStart(long clusterId, String clusterName, List<HostResources> hostsToStart);  }
@Test public void clusterResourcesAvailableToStartTest() { List<HostResources> hosts = createClusterHomogeneousHosts(1); ClusterResourcesAvailableToStart cluster = clusterResourcesService.createClusterResourcesAvailableToStart(random.nextLong(), "cluster", hosts); checkCpuAndMemory(cluster); Assert.assertEquals(hosts, cluster.getHostsToStart()); }