@Test
public void scheduleRestartForVmsOnHostNonEmptyVMList() {

  Mockito.when(hostVO.getId()).thenReturn(1l);
  Mockito.when(hostVO.getType()).thenReturn(Host.Type.Routing);
  Mockito.when(hostVO.getHypervisorType()).thenReturn(HypervisorType.XenServer);
  final List<VMInstanceVO> vms = new ArrayList<VMInstanceVO>();
  final VMInstanceVO vm1 = Mockito.mock(VMInstanceVO.class);
  Mockito.when(vm1.getHostId()).thenReturn(1l);
  Mockito.when(vm1.getInstanceName()).thenReturn("i-2-3-VM");
  Mockito.when(vm1.getType()).thenReturn(VirtualMachine.Type.User);
  Mockito.when(vm1.isHaEnabled()).thenReturn(true);
  vms.add(vm1);
  final VMInstanceVO vm2 = Mockito.mock(VMInstanceVO.class);
  Mockito.when(vm2.getHostId()).thenReturn(1l);
  Mockito.when(vm2.getInstanceName()).thenReturn("r-2-VM");
  Mockito.when(vm2.getType()).thenReturn(VirtualMachine.Type.DomainRouter);
  Mockito.when(vm2.isHaEnabled()).thenReturn(true);
  vms.add(vm2);
  Mockito.when(_instanceDao.listByHostId(Mockito.anyLong())).thenReturn(vms);
  Mockito.when(_instanceDao.findByUuid(vm1.getUuid())).thenReturn(vm1);
  Mockito.when(_instanceDao.findByUuid(vm2.getUuid())).thenReturn(vm2);
  Mockito.when(_podDao.findById(Mockito.anyLong())).thenReturn(Mockito.mock(HostPodVO.class));
  Mockito.when(_dcDao.findById(Mockito.anyLong())).thenReturn(Mockito.mock(DataCenterVO.class));
  Mockito.when(_haDao.findPreviousHA(Mockito.anyLong())).thenReturn(Arrays.asList(Mockito.mock(HaWorkVO.class)));
  Mockito.when(_haDao.persist((HaWorkVO)Mockito.anyObject())).thenReturn(Mockito.mock(HaWorkVO.class));
  highAvailabilityManager.scheduleRestartForVmsOnHost(hostVO, true);
}