opentracing / opentracing-java

OpenTracing API for Java. 🛑 This library is DEPRECATED! https://github.com/opentracing/specification/issues/163
http://opentracing.io
Apache License 2.0
1.68k stars 344 forks source link

Unit tests fail with "AbstractMethodError" #364

Closed JJonesAtAvaya closed 5 years ago

JJonesAtAvaya commented 5 years ago

When unit tests touch code that use opentrace spans, they are failing with abstraction errors:

one example:

  @Test
  public void testAThing() throws Exception {
    final Span span = tracer.buildSpan("test").start()
        .setOperationName("test")
        .setTag("key", "value")
        .log("event")
        .log(singletonMap("key", "value"));
    try (final Scope ignored = tracer.activateSpan(span)) {
      int foo = 1;
      int bar = foo + 1;
    }
    // fails with: java.lang.AbstractMethodError: io.opentracing.util.AutoFinishScopeManager.activeSpan()Lio/opentracing/Span;
  }
yurishkuro commented 5 years ago

make sure you're using consistent versions of opentracing artifacts.

JJonesAtAvaya commented 5 years ago

I want to close this as I figured out what to do

Just add a @Before method and set the GlobalTracer to MockTracer