### Question:
LongTaskTimer implements com.netflix.spectator.api.LongTaskTimer { @Override public Iterable<Measurement> measure() { final List<Measurement> ms = new ArrayList<>(2); final long now = clock.wallTime(); final double durationSeconds = duration() / NANOS_PER_SECOND; ms.add(new Measurement(id.withTag(Statistic.duration), now, durationSeconds)); ms.add(new Measurement(id.withTag(Statistic.activeTasks), now, activeTasks())); return ms; } private  LongTaskTimer(Registry registry, Id id); static LongTaskTimer get(Registry registry, Id id); @Override Id id(); @Override boolean hasExpired(); @Override long start(); @Override long stop(long task); @Override long duration(long task); @Override long duration(); @Override int activeTasks(); @Override Iterable<Measurement> measure();  }### Answer:
@Test public void testMeasure() { com.netflix.spectator.api.LongTaskTimer t = LongTaskTimer.get(registry, id); long task1 = t.start(); clock.setMonotonicTime(1_000_000_000L); clock.setWallTime(1L); assertLongTaskTimer(t, 1L, 1, 1.0); long task2 = t.start(); assertLongTaskTimer(t, 1L, 2, 1.0); t.stop(task1); assertLongTaskTimer(t, 1L, 1, 0.0); t.stop(task2); assertLongTaskTimer(t, 1L, 0, 0.0); }