### Question:
TracezDataAggregator { Map<String, Map<LatencyBoundary, Integer>> getSpanLatencyCounts() { Map<String, TracezSpanBuckets> completedSpanCache = spanProcessor.getCompletedSpanCache(); Map<String, Map<LatencyBoundary, Integer>> numSpansPerName = new HashMap<>(); for (Map.Entry<String, TracezSpanBuckets> cacheEntry : completedSpanCache.entrySet()) { numSpansPerName.put( cacheEntry.getKey(), cacheEntry.getValue().getLatencyBoundaryToCountMap()); } return numSpansPerName; } TracezDataAggregator(TracezSpanProcessor spanProcessor);   }### Answer:
@Test void getSpanLatencyCounts_noSpans() { Map<String, Map<LatencyBoundary, Integer>> counts = dataAggregator.getSpanLatencyCounts(); assertThat(counts).isEmpty(); }
@Test void getSpanLatencyCounts_noCompletedSpans() { Span span = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); Map<String, Map<LatencyBoundary, Integer>> counts = dataAggregator.getSpanLatencyCounts(); span.end(); assertThat(counts).isEmpty(); }
@Test void getSpanLatencyCounts_oneSpanPerLatencyBucket() { for (LatencyBoundary bucket : LatencyBoundary.values()) { Span span = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); testClock.advanceNanos(bucket.getLatencyLowerBound()); span.end(); } Map<String, Map<LatencyBoundary, Integer>> counts = dataAggregator.getSpanLatencyCounts(); for (LatencyBoundary bucket : LatencyBoundary.values()) { assertThat(counts.get(SPAN_NAME_ONE).get(bucket)).isEqualTo(1); } }