ConsolidationScoredPreferenceForSmallHosts extends ConsolidationAlgorithmBase { protected List<HostResources> setEachHostScore(List<HostResources> hosts) { for (HostResources host : hosts) { host.setScore(calculateHostScore(host)); } return hosts; }  @Override List<HostResources> rankHosts(List<HostResources> hostsList); @Override List<HostResources> rankHostToPowerOff(List<HostResources> idleHosts);  }
@Test public void setEachHostScoreTest() { Mockito.doReturn(1.0).when(spyAlgorithm).calculateHostScore(Mockito.any(HostResources.class)); List<HostResources> hosts = createHosts(); spyAlgorithm.setEachHostScore(hosts); Mockito.verify(spyAlgorithm, Mockito.times(2)).calculateHostScore(Mockito.any(HostResources.class)); for (HostResources host : hosts) { Assert.assertEquals(1.0, host.getScore(), 0.0); } }