Closed mmimica closed 4 years ago
The proper way of doing this would be composition, not inheritance. You can take a look at https://github.com/zalando/opentracing-toolbox/tree/master/opentracing-proxy to see an example.
The proper way of doing this would be composition, not inheritance.
Indeed.
if you extend MockTracer.SpanBuilder, then you do not need this change.
My extension to SpanBuilder is generic and has nothing to do with mocks, so I'm not going do that.
if you're using MockTracer, you should be extending its subcomponents.
You're proposing a breaking change.
This makes it possible to override
buildSpan(String op)
of MockTracer and return another impl ofTracer.SpanBuilder
. A use-case for this would be, for example, to supply an instance ofSpanBuilder
that delegates to originalMockTracer.SpanBuilder
, but also performs additional logging.