### Question:
LongTaskTimer implements com.netflix.spectator.api.LongTaskTimer { @Override public long stop(long task) { Long startTime = tasks.get(task); if (startTime != null) { tasks.remove(task); return clock.monotonicTime() - startTime; } else { return -1L; } } 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 testStop() { com.netflix.spectator.api.LongTaskTimer t = LongTaskTimer.get(registry, id); long task1 = t.start(); long task2 = t.start(); Assertions.assertEquals(t.activeTasks(), 2); clock.setMonotonicTime(5L); Assertions.assertEquals(t.duration(), 10L); long elapsed1 = t.stop(task1); Assertions.assertEquals(-1L, t.stop(task1)); Assertions.assertEquals(elapsed1, 5L); Assertions.assertEquals(t.duration(task2), 5L); Assertions.assertEquals(t.duration(task1), -1L); Assertions.assertEquals(t.duration(), 5L); }