use of io.opentelemetry.api.trace.TraceId in project splunk-otel-java by signalfx.
the class JfrContextStorageTest method testNotSampled.
@Test
void testNotSampled() {
Scope scope = mock(Scope.class);
ContextStorage delegate = mock(ContextStorage.class);
spanContext = SpanContext.create(traceId, spanId, TraceFlags.getDefault(), TraceState.getDefault());
span = Span.wrap(spanContext);
newContext = Context.root().with(span);
when(delegate.attach(newContext)).thenReturn(scope);
AtomicBoolean newEventWasCalled = new AtomicBoolean(false);
Function<SpanContext, ContextAttached> newEvent = x -> {
newEventWasCalled.set(true);
return null;
};
JfrContextStorage contextStorage = new JfrContextStorage(delegate, newEvent);
Scope result = contextStorage.attach(newContext);
assertEquals(scope, result);
assertFalse(newEventWasCalled.get());
}
Aggregations