use of io.opencensus.trace.ContextHandle in project instrumentation-java by census-instrumentation.
the class ContextUtilsTest method testGetCurrentSpan_ContextSetToNull.
@Test
public void testGetCurrentSpan_ContextSetToNull() {
ContextHandle orig = ContextHandleUtils.withValue(ContextHandleUtils.currentContext(), null).attach();
try {
Span span = ContextHandleUtils.getValue(ContextHandleUtils.currentContext());
// ContextUtils.getValue always returns non-null.
assertThat(span).isEqualTo(BlankSpan.INSTANCE);
} finally {
ContextHandleUtils.currentContext().detach(orig);
}
}
Aggregations