### Question:
DoubleDistributionSummary implements Meter { @Override public Iterable<Measurement> measure() { final long now = clock.wallTime(); final long prev = lastResetTime.get(); final long delta = now - prev; final boolean reset = delta > resetFreq; if (reset) { lastResetTime.set(now); } final List<Measurement> ms = new ArrayList<>(3); if (delta > 1000L) { ms.add(new Measurement(countId, now, toRateLong(count, delta, reset))); ms.add(new Measurement(totalAmountId, now, toRateDouble(totalAmount, delta, reset))); ms.add(new Measurement(totalOfSquaresId, now, toRateDouble(totalOfSquares, delta, reset))); ms.add(new Measurement(maxId, now, toDouble(max, reset))); } return ms; } DoubleDistributionSummary(Clock clock, Id id, long resetFreq); static DoubleDistributionSummary get(Id id); @Override Id id(); @Override boolean hasExpired(); @Override Iterable<Measurement> measure(); void record(double amount); long count(); double totalAmount();  }### Answer:
@Test public void testMeasure() { DoubleDistributionSummary t = newInstance(); t.record(42.0); clock.setWallTime(65000L); for (Measurement m : t.measure()) { Assertions.assertEquals(m.timestamp(), 65000L); switch (get(m.id(), "statistic")) { case "count": Assertions.assertEquals(m.value(), 1.0 / 65.0, 1e-12); break; case "totalAmount": Assertions.assertEquals(m.value(), 42.0 / 65.0, 1e-12); break; case "totalOfSquares": Assertions.assertEquals(m.value(), 42.0 * 42.0 / 65.0, 1e-12); break; case "max": Assertions.assertEquals(m.value(), 42.0, 1e-12); break; default: Assertions.fail("unexpected id: " + m.id()); break; } } }