### Question:
DefaultTimer extends AbstractTimer { @Override public Iterable<Measurement> measure() { final long now = clock.wallTime(); final List<Measurement> ms = new ArrayList<>(2); ms.add(new Measurement(id.withTag(Statistic.count), now, count.get())); ms.add(new Measurement(id.withTag(Statistic.totalTime), now, totalTime.get())); return ms; } DefaultTimer(Clock clock, Id id); @Override Id id(); @Override boolean hasExpired(); @Override void record(long amount, TimeUnit unit); @Override Iterable<Measurement> measure(); @Override long count(); @Override long totalTime();  }### Answer:
@Test public void testMeasure() { Timer t = new DefaultTimer(clock, new DefaultId("foo")); t.record(42, TimeUnit.MILLISECONDS); clock.setWallTime(3712345L); for (Measurement m : t.measure()) { Assertions.assertEquals(m.timestamp(), 3712345L); if (m.id().equals(t.id().withTag(Statistic.count))) { Assertions.assertEquals(m.value(), 1.0, 0.1e-12); } else if (m.id().equals(t.id().withTag(Statistic.totalTime))) { Assertions.assertEquals(m.value(), 42e6, 0.1e-12); } else { Assertions.fail("unexpected id: " + m.id()); } } }