StartedKamonTimer implements StartedTimer { @Override public Map<String, StartedTimer> getSegments() { return new HashMap<>(segments); } 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 getSegments() { assertThat(sut.getSegments().keySet()).hasSize(0); final StartedTimer testSegment = sut.startNewSegment("TEST"); final Map<String, StartedTimer> segments = sut.getSegments(); assertThat(segments).hasSize(1); assertThat(segments.get("TEST")).isEqualTo(testSegment); }