use of io.jaegertracing.spi.BaggageRestrictionManager in project jaeger-client-java by jaegertracing.
the class JaegerSpanTest method testSetAndGetBaggageItem.
@Test
public void testSetAndGetBaggageItem() {
final String service = "SamplerTest";
final BaggageRestrictionManager mgr = Mockito.mock(DefaultBaggageRestrictionManager.class);
tracer = new JaegerTracer.Builder(service).withReporter(reporter).withSampler(new ConstSampler(true)).withClock(clock).withBaggageRestrictionManager(mgr).build();
jaegerSpan = tracer.buildSpan("some-operation").start();
final String key = "key";
final String value = "value";
when(mgr.getRestriction(service, key)).thenReturn(Restriction.of(true, 10));
jaegerSpan.setBaggageItem(key, "value");
verify(mgr).getRestriction(service, key);
assertEquals(value, jaegerSpan.getBaggageItem(key));
}
Aggregations