ConsolidationXenHaPreferenceForBigHostsHomogeneousEnvironment extends ConsolidationScoredPreferenceForBigHosts { protected void removeOneIfPossible(List<HostResources> rankedHostToPowerOff) { if (rankedHostToPowerOff.isEmpty()) { return; } rankedHostToPowerOff.remove(rankedHostToPowerOff.size() - 1); }  @Override List<HostResources> rankHosts(List<HostResources> hostsList); @Override Map<Long, HostResources> mapVMsToHost(List<HostResources> rankedHosts); @Override List<HostResources> rankHostToPowerOff(List<HostResources> idleHosts);  }
@Test public void removeOneIfPossibleTestListNotEmpty() { List<HostResources> hosts = createClusterHomogeneousHosts(2); consolidationAlgorithm.removeOneIfPossible(hosts); Assert.assertEquals(1, hosts.size()); }
@Test public void removeOneIfPossibleTestListEmpty() { List<HostResources> hosts = createClusterHomogeneousHosts(0); consolidationAlgorithm.removeOneIfPossible(hosts); Assert.assertEquals(0, hosts.size()); }