StartedKamonTimer implements StartedTimer { @Override public List<OnStopHandler> getOnStopHandlers() { return new ArrayList<>(onStopHandlers); } private  StartedKamonTimer(final String name, final Map<String, String> tags); @Override StartedTimer tags(final Map<String, String> tags); @Nullable @Override String getTag(final String key); @Override Map<String, String> getTags(); @Override StartedTimer tag(final String key, final String value); @Override StoppedTimer stop(); @Override boolean isRunning(); @Override StartedTimer startNewSegment(final String segmentName); @Override StartedTimer onStop(final OnStopHandler onStopHandler); @Override String getName(); @Override Long getStartTimeStamp(); @Override Map<String, StartedTimer> getSegments(); @Override List<OnStopHandler> getOnStopHandlers(); @Override String toString();  }
@Test public void getOnStopHandlers() { final OnStopHandler onStopHandler = mock(OnStopHandler.class); sut.onStop(onStopHandler); final List<OnStopHandler> onStopHandlers = sut.getOnStopHandlers(); assertThat(onStopHandlers).hasSize(1); assertThat(onStopHandlers).contains(onStopHandler); }