### Question:
DataGatherer implements Runnable { public ArrayList<VmDeployed> getVMsOnHost(Host host) { return getVMsOnHost(host, datasource.getVmList()); } DataGatherer(HostDataSource datasource, DatabaseConnector connector, Calibrator calibrator); void stop(); double getGeneralPurposeHostsPowerConsumption(); @Override void run(); void setRule(EnergyShareRule rule); HashMap<String, Host> getHostList(); HashMap<String, GeneralPurposePowerConsumer> getGeneralPurposeHostList(); Host getHost(String hostname); HashMap<String, VmDeployed> getVmList(); HashSet<VmDeployed> getVmList(String deploymentId); VmDeployed getVm(String name); VmDeployed getVm(int vmId); boolean setVm(VmDeployed vm); ArrayList<VmDeployed> getVMsOnHost(Host host); ArrayList<VmDeployed> getVMsOnHost(Host host, List<VmDeployed> activeVMs); void setPerformDataGathering(boolean performDataGathering); boolean performDataGathering();  }### Answer:
@Test public void testGetVMsOnHost() { System.out.println("getVMsOnHost"); Host host = CHOSEN_HOST2; DataGatherer instance = getDataGatherer(); ArrayList<VmDeployed> result = instance.getVMsOnHost(host); for (VmDeployed vm : result) { System.out.println("VM: " + vm.getName()); assert (vm.getAllocatedTo() != null); System.out.println("VM Host: " + vm.getAllocatedTo().getHostName()); } }