HostResourcesService { protected boolean isVmCurrentlyUsingHostResource(VMInstanceVO vmInstance) { return VirtualMachine.State.Running == vmInstance.getState() || VirtualMachine.State.Migrating == vmInstance.getState() || VirtualMachine.State.Starting == vmInstance.getState(); }  HostResources createAndConfigureHostResources(HostVO hostVo); HostResources createHostResources(HostVO hostVO);  }
@Test public void isVmStateRunningTest() { vmInstance.setState(VirtualMachine.State.Running); Assert.assertTrue(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateMigratingTest() { vmInstance.setState(VirtualMachine.State.Migrating); Assert.assertTrue(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateStartingTest() { vmInstance.setState(VirtualMachine.State.Starting); Assert.assertTrue(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateDestroyedTest() { vmInstance.setState(VirtualMachine.State.Destroyed); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateErrorTest() { vmInstance.setState(VirtualMachine.State.Error); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateExpungingTest() { vmInstance.setState(VirtualMachine.State.Expunging); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateShutdownedTest() { vmInstance.setState(VirtualMachine.State.Shutdowned); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateStoppingTest() { vmInstance.setState(VirtualMachine.State.Stopping); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }
@Test public void isVmStateUnknownTest() { vmInstance.setState(VirtualMachine.State.Unknown); Assert.assertFalse(hostResourcesService.isVmCurrentlyUsingHostResource(vmInstance)); }