@Test
public void mapVMsToHost() {

    List<HostResources> hosts = createHosts();
    Map<Long, HostResources> migrations = spyAlgorithm.mapVMsToHost(hosts);
    long id = hosts.get(1).getVmsResources().get(0).getVmId();
    Assert.assertEquals(1, migrations.size());
    Assert.assertEquals(3000l, hosts.get(0).getUsedCpu());
    Assert.assertEquals(1500l, hosts.get(0).getUsedMemoryInMegaBytes());
    Assert.assertEquals(hosts.get(0).getHostId(), migrations.get(id).getHostId());
    InOrder inOrder = Mockito.inOrder(spyAlgorithm);
    inOrder.verify(spyAlgorithm).canMigrateVmToHost(hosts.get(1).getVmsResources().get(0), hosts.get(0));
    inOrder.verify(spyAlgorithm).updateHostUsedResources(hosts.get(1).getVmsResources().get(0), hosts.get(0));
}