### Question:
TracezDataAggregator { List<SpanData> getRunningSpans(String spanName) { Collection<ReadableSpan> allRunningSpans = spanProcessor.getRunningSpans(); List<SpanData> filteredSpans = new ArrayList<>(); for (ReadableSpan span : allRunningSpans) { if (span.getName().equals(spanName)) { filteredSpans.add(span.toSpanData()); } } return filteredSpans; } TracezDataAggregator(TracezSpanProcessor spanProcessor);   }### Answer:
@Test void getRunningSpans_noSpans() { assertThat(dataAggregator.getRunningSpans(SPAN_NAME_ONE)).isEmpty(); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_TWO)).isEmpty(); }
@Test void getRunningSpans_oneSpanName() { Span span1 = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); Span span2 = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); Span span3 = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); List<SpanData> spans = dataAggregator.getRunningSpans(SPAN_NAME_ONE); assertThat(spans) .containsExactlyInAnyOrder( ((ReadableSpan) span1).toSpanData(), ((ReadableSpan) span2).toSpanData(), ((ReadableSpan) span3).toSpanData()); span1.end(); span2.end(); span3.end(); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_ONE)).isEmpty(); }
@Test void getRunningSpans_twoSpanNames() { Span span1 = tracer.spanBuilder(SPAN_NAME_ONE).startSpan(); Span span2 = tracer.spanBuilder(SPAN_NAME_TWO).startSpan(); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_ONE)) .containsExactly(((ReadableSpan) span1).toSpanData()); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_TWO)) .containsExactly(((ReadableSpan) span2).toSpanData()); span1.end(); span2.end(); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_ONE)).isEmpty(); assertThat(dataAggregator.getRunningSpans(SPAN_NAME_TWO)).isEmpty(); }