### Question:
DataGatherer implements Runnable { public VmDeployed getVm(String name) { VmDeployed answer = knownVms.get(name); if (answer != null) { return validateVMInformation(answer); } List<VmDeployed> vmList = datasource.getVmList(); refreshKnownVMList(vmList); return validateVMInformation(knownVms.get(name)); } 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 testGetVm() { System.out.println("getVm"); String name = VM_NAME; DataGatherer instance = getDataGatherer(); Thread dataGatherThread = new Thread(instance); dataGatherThread.setDaemon(true); dataGatherThread.start(); VmDeployed result = instance.getVm(name); assert (result != null); assertEquals(VM_NAME, result.getName()); }