MockTracer implements Tracer { @Override public synchronized void close() { this.isClosed = true; this.finishedSpans.clear(); } MockTracer();  MockTracer(ScopeManager scopeManager);  MockTracer(ScopeManager scopeManager, Propagator propagator);  MockTracer(Propagator propagator); synchronized void reset(); synchronized List<MockSpan> finishedSpans(); synchronized Map<String, Map<String, MockSpan>> finishedTraces(); @Override ScopeManager scopeManager(); @Override SpanBuilder buildSpan(String operationName); @Override void inject(SpanContext spanContext, Format<C> format, C carrier); @Override SpanContext extract(Format<C> format, C carrier); @Override Span activeSpan(); @Override Scope activateSpan(Span span); @Override synchronized void close();  }
@Test public void testClose() { MockTracer mockTracer = new MockTracer(); mockTracer.buildSpan("foo").start().finish(); mockTracer.close(); assertEquals(0, mockTracer.finishedSpans().size()); mockTracer.buildSpan("foo").start().finish(); assertEquals(0, mockTracer.finishedSpans().size()); }