@Test
public void testDiffCalculation() throws Exception {

  Map<Long, Double> metricValues = new TreeMap<>();
  metricValues.put(1454016368371L, 1011.25);
  metricValues.put(1454016428371L, 1010.25);
  metricValues.put(1454016488371L, 1012.25);
  metricValues.put(1454016548371L, 1010.25);
  metricValues.put(1454016608371L, 1010.25);
  Map<Long, Double> rates = HBaseTimelineMetricStore.updateValuesAsRate(new TreeMap<>(metricValues), true);
  Assert.assertTrue(rates.size()==4);
  Assert.assertTrue(rates.containsValue(-1.0));
  Assert.assertTrue(rates.containsValue(2.0));
  Assert.assertTrue(rates.containsValue(0.0));
}