### Question:
StopwatchTimeline extends Timeline<StopwatchTimeRange> { public void addSplit(Split split) { final long timestamp = split.getStartMillis(); StopwatchTimeRange timeRange; synchronized (this) { timeRange = getOrCreateTimeRange(timestamp); } if (timeRange != null) { synchronized (timeRange) { timeRange.addSplit(timestamp, split.runningFor()); } } } StopwatchTimeline(int capacity, long timeRangeWidth); void addSplit(Split split); @Override TimelineSample<StopwatchTimeRange> sample();  }### Answer:
@Test public void testAddSplit() { StopwatchTimeline timeline = new StopwatchTimeline(10, 5 * 60 * 1000); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 51, 12), 100)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 52, 13), 200)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 53, 14), 300)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 56, 15), 100)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 57, 16), 200)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 54, 17), 200)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 44, 18), 400)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 22, 1, 19), 100)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 22, 2, 20), 200)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 22, 3, 21), 200)); timeline.addSplit(createSplit(createTimestamp(2012, 7, 12, 21, 54, 22), 250)); StopwatchTimeRange[] timeRanges = timeline.sample().getTimeRanges(); for (StopwatchTimeRange timeRange : timeRanges) { System.out.println(timeRange.toString()); } assertEquals(timeRanges.length, 3); assertEquals(timeRanges[0].getCounter(), 5); assertEquals(timeRanges[1].getCounter(), 2); assertEquals(timeRanges[2].getCounter(), 3); }