public void testShouldResetWhenLivingLongerThenItsPeriod() throws Exception {
long timePeriodPlusOne = rate.starttimestamp + rate.period + 1;
Reading reading = new SettableReading().withTimestamp(timePeriodPlusOne);
Metric muchYoungerMetric = new Metric("metric", reading);
// Old period's readings
Metric oldMetric = new Metric("metric", new Reading());
rate.applyMetric(oldMetric);
assertEquals(1, (int) rate.getResult());
// Force new period by pretending a measure from far future
rate.applyMetric(muchYoungerMetric);