### Question:
InMemoryTracing { public abstract InMemorySpanExporter getSpanExporter();  abstract InMemorySpanExporter getSpanExporter(); static Builder builder();  }### Answer:
@Test void getFinishedSpanItems() { tracer.spanBuilder("A").startSpan().end(); tracer.spanBuilder("B").startSpan().end(); List<SpanData> finishedSpanItems = tracing.getSpanExporter().getFinishedSpanItems(); assertThat(finishedSpanItems).hasSize(2); assertThat(finishedSpanItems.get(0).getName()).isEqualTo("A"); assertThat(finishedSpanItems.get(1).getName()).isEqualTo("B"); }
@Test void getFinishedSpanItems_sampled() { tracer.spanBuilder("A").startSpan().end(); TraceConfig originalConfig = tracerSdkProvider.getActiveTraceConfig(); tracerSdkProvider.updateActiveTraceConfig( originalConfig.toBuilder().setSampler(Samplers.alwaysOff()).build()); try { tracer.spanBuilder("B").startSpan().end(); } finally { tracerSdkProvider.updateActiveTraceConfig(originalConfig); } List<SpanData> finishedSpanItems = tracing.getSpanExporter().getFinishedSpanItems(); assertThat(finishedSpanItems).hasSize(1); assertThat(finishedSpanItems.get(0).getName()).isEqualTo("A"); }
@Test void reset() { tracer.spanBuilder("A").startSpan().end(); tracer.spanBuilder("B").startSpan().end(); assertThat(tracing.getSpanExporter().getFinishedSpanItems()).hasSize(2); tracing.getSpanExporter().reset(); assertThat(tracing.getSpanExporter().getFinishedSpanItems()).hasSize(0); }