### Question:
Calibrator implements Runnable { public void calibrateHostEnergyData(Host host) { queue.add(host); } Calibrator(HostDataSource dataSource, DatabaseConnector database); void calibrateHostEnergyData(Host host); boolean isQueued(Host host); final void setGenerator(String loadGeneratorName); void setDatasource(HostDataSource datasource); void stop(); @Override void run();  }### Answer:
@Test public void testCalibrateHostEnergyData() { System.out.println("calibrateHostEnergyData"); Host host = new Host(10105, "asok09"); ZabbixDataSourceAdaptor adaptor = new ZabbixDataSourceAdaptor(); DefaultDatabaseConnector database = new DefaultDatabaseConnector(); Calibrator instance = new Calibrator(adaptor, database); Thread calibratorThread; calibratorThread = new Thread(instance); calibratorThread.setDaemon(true); calibratorThread.start(); Host expResult = CHOSEN_HOST; host = database.getHostCalibrationData(host); int orginalCalibrationData = host.getCalibrationData().size(); instance.calibrateHostEnergyData(host); int count = 0; while (orginalCalibrationData == host.getCalibrationData().size() && count < 300) { try { Thread.sleep(2000); count = count + 1; } catch (InterruptedException ex) { Logger.getLogger(CalibratorTest.class.getName()).log( Level.SEVERE, "The test was interupted.", ex); Assert.fail(); } } try { Thread.sleep(30000); } catch (InterruptedException ex) { Logger.getLogger(CalibratorTest.class.getName()).log(Level.SEVERE, "The test was interupted.", ex); Assert.fail(); } assertEquals(expResult, host); assert (host.getIdlePowerConsumption() > 0.0); System.out.println("Idle Power: " + host.getIdlePowerConsumption()); assert (host.isCalibrated()); System.out.println("Calibration Data Count: " + host.getCalibrationData().size()); }