@Test public void testNormalizedMissedHeartbeat() throws Exception { List<Metric> inputList = UnmodifiableList.of( newMetric(0, 10.0), newMetric(10, 10.0), newMetric(30, 10.0)); List<TimeVal> expected = UnmodifiableList.of( TimeVal.from(0, 10.0), TimeVal.from(10, 10.0), TimeVal.from(30, 10.0)); assertMetrics(10, 20, inputList, expected); }
@Test public void testAlreadyNormalized() throws Exception { List<Metric> inputList = UnmodifiableList.of( newMetric(0, 10.0), newMetric(10, 20.0), newMetric(20, 30.0), newMetric(30, 10.0)); List<TimeVal> expected = UnmodifiableList.of( TimeVal.from(0, 10.0), TimeVal.from(10, 20.0), TimeVal.from(20, 30.0), TimeVal.from(30, 10.0)); assertMetrics(10, 20, inputList, expected); }
@Test public void testRandomOffset() throws Exception { List<Metric> inputList = UnmodifiableList.of( newMetric(t(1, 13), 1.0), newMetric(t(2, 13), 1.0), newMetric(t(3, 13), 1.0)); List<TimeVal> expected = UnmodifiableList.of( TimeVal.from(t(1, 0), 47.0 / 60.0), TimeVal.from(t(2, 0), 1.0), TimeVal.from(t(3, 0), 1.0)); assertMetrics(60000, 120000, inputList, expected); }
@Test public void testBasic() throws Exception { List<Metric> inputList = UnmodifiableList.of( newMetric(5, 1.0), newMetric(15, 2.0), newMetric(25, 2.0), newMetric(35, 1.0), newMetric(85, 1.0), newMetric(95, 2.0), newMetric(105, 2.0)); List<TimeVal> expected = UnmodifiableList.of( TimeVal.from(0, 0.5), TimeVal.from(10, 1.5), TimeVal.from(20, 2.0), TimeVal.from(30, 1.5), TimeVal.from(80, 0.5), TimeVal.from(90, 1.5), TimeVal.from(100, 2.0) ); assertMetrics(10, 20, inputList, expected); }