DateTime hour0 = hour0();
DateTime currentTime = hour0.plusHours(4).plusMinutes(44);
DateTime threeMinutesAgo = currentTime.minusMinutes(3);
int scheduleId = 1;
MeasurementDataNumeric expected = new MeasurementDataNumeric(threeMinutesAgo.getMillis(), scheduleId, 1.23);
WaitForWrite waitForResults = new WaitForWrite(1);
StorageResultSetFuture resultSetFuture = dao.insertRawData(expected);
Futures.addCallback(resultSetFuture, waitForResults);
waitForResults.await("Failed to insert raw data");
List<RawNumericMetric> actualMetrics = Lists.newArrayList(dao.findRawMetrics(scheduleId,
threeMinutesAgo.minusSeconds(1).getMillis(), threeMinutesAgo.plusSeconds(1).getMillis()));
assertEquals(actualMetrics.size(), 1, "Expected to get back one raw metric");
assertEquals(actualMetrics.get(0), new RawNumericMetric(scheduleId, expected.getTimestamp(),
expected.getValue()), "The raw metric does not match the expected value");
}