HostResourcesService { protected void loadHostOverprovisioningFactors(HostResources host) { ConfigurationVO configVO = configurationDao.findByName(CPU_OVERPROVISIONING_CONFIGURARTION_NAME); host.setCpuOverprovisioning(Float.parseFloat(configVO.getValue())); configVO = configurationDao.findByName(MEMORY_OVERPROVISIONING_CONFIGURARTION_NAME); host.setMemoryOverprovisioning(Float.parseFloat(configVO.getValue())); }  HostResources createAndConfigureHostResources(HostVO hostVo); HostResources createHostResources(HostVO hostVO);  }
@Test public void loadHostOverprovisioningFactorsTest() { HostResources hostResources = new HostResources(); ConfigurationVO configurationVOCpu = Mockito.mock(ConfigurationVO.class); ConfigurationVO configurationVOMem = Mockito.mock(ConfigurationVO.class); Mockito.when(configurationDao.findByName("cpu.overprovisioning.factor")).thenReturn(configurationVOCpu); Mockito.when(configurationVOCpu.getValue()).thenReturn("1.5"); Mockito.when(configurationDao.findByName("mem.overprovisioning.factor")).thenReturn(configurationVOMem); Mockito.when(configurationVOMem.getValue()).thenReturn("2.0"); hostResourcesService.loadHostOverprovisioningFactors(hostResources); Assert.assertEquals(1.5, hostResources.getCpuOverprovisioning(), 0f); Assert.assertEquals(2.0, hostResources.getMemoryOverprovisioning(), 0f); }