HostProfiler { public ClusterVmProfile getHostsVmsResources() { ClusterVmProfile vmsProfile = new ClusterVmProfile(); for(HostResources host : hosts) { List<VmResources> vmsOnHost = host.getVmsResources(); for(VmResources vmResources : vmsOnHost) { vmsProfile.setNumberOfInstances(vmsProfile.getNumberOfInstances() + 1); vmsProfile.setTotalCpus(vmsProfile.getTotalCpus() + vmResources.getNumberOfCpus()); vmsProfile.setTotalCpuSpeed((int) (vmsProfile.getTotalCpuSpeed() + vmResources.getCpuSpeed())); vmsProfile.setTotalMemory((int) (vmsProfile.getTotalMemory() + vmResources.getMemoryInMegaBytes())); } } return vmsProfile; } HostProfiler(List<HostResources> hosts); HostProfile hostVMsResourceProportion(HostResources host); ClusterVmProfile createClusterVmsProfile(ClusterVmProfile vmsProfile); ClusterVmProfile getHostsVmsResources();  }
@Test public void getHostsVmsResources() { ClusterVmProfile vmsProfile = spyProfiler.getHostsVmsResources(); Assert.assertEquals(3, vmsProfile.getNumberOfInstances()); Assert.assertEquals(3, vmsProfile.getTotalCpus()); Assert.assertEquals(3000, vmsProfile.getTotalCpuSpeed()); Assert.assertEquals(1500, vmsProfile.getTotalMemory()); }