### Question:
ClusterState extends AbstractPersistable implements Solution<Score> { public List<Vm> getVmsDeployedInHost(Host host) { List<Vm> result = new ArrayList<>(); for (Vm vm: vms) { if (host.equals(vm.getHost())) { result.add(vm); } } return result; } ClusterState(); boolean hostIsIdle(Host host); int countIdleHosts(); int countNonIdleHosts(); List<String> getIdsOfAppsDeployedInHost(Host host); List<Vm> getVmsDeployedInHost(Host host); double avgCpusAssignedPerHost(); int cpusAssignedInHost(Host host); int calculateCumulativeUnusedCpuPerc(); double calculateStdDevCpuPercUsedPerHost(); int countOffHosts(); int countVmMigrationsNeeded(ClusterState destinyClusterState); Vm getVmById(long id); @PlanningEntityCollectionProperty List<Vm> getVms(); void setVms(List<Vm> vms); @ValueRangeProvider(id = "hostRange") List<Host> getHosts(); void setHosts(List<Host> hosts); @Override Score getScore(); @Override void setScore(Score score); @Override Collection<?> getProblemFacts(); @Override String toString();  }### Answer:
@Test public void getVmsDeployedInHost() { for (Host host: clusterState.getHosts()) { if (host.getId() == (long) 1) { assertEquals(2, clusterState.getVmsDeployedInHost(host).size()); } else if (host.getId() == (long) 2) { assertEquals(0, clusterState.getVmsDeployedInHost(host).size()); } } }