HostProfiler { public HostProfile hostVMsResourceProportion(HostResources host) { ClusterVmProfile clusterVmsProfile = createClusterVmsProfile(getHostsVmsResources()); HostProfile hostProfile = new HostProfile(); hostProfile.setCpusProfile(host.getCpus() / clusterVmsProfile.getCpusProfile()); hostProfile.setCpuSpeedProfile((host.getSpeed() * host.getCpuOverprovisioning()) / clusterVmsProfile.getCpuSpeedProfile()); hostProfile.setMemoryProfile(((host.getTotalMemoryInBytes() / BYTES_TO_MEGA_BYTES) * host.getMemoryOverprovisioning()) / clusterVmsProfile.getMemoryProfile()); return hostProfile; } HostProfiler(List<HostResources> hosts); HostProfile hostVMsResourceProportion(HostResources host); ClusterVmProfile createClusterVmsProfile(ClusterVmProfile vmsProfile); ClusterVmProfile getHostsVmsResources();  }
@Test public void hostVMsResourceProportionTest() { HostProfile hostProfile = spyProfiler.hostVMsResourceProportion(createHost(4, 1000l, 0l, 5000l, 0l)); Assert.assertNotNull(hostProfile); Assert.assertEquals(1.0, hostProfile.getCpuSpeedProfile(), 0.0); Assert.assertEquals(4, hostProfile.getCpusProfile(), 0.0); Assert.assertEquals(10, hostProfile.getMemoryProfile(), 0.0); InOrder inOrder = Mockito.inOrder(spyProfiler); inOrder.verify(spyProfiler).getHostsVmsResources(); inOrder.verify(spyProfiler).createClusterVmsProfile(Mockito.any(ClusterVmProfile.class)); }