### Question:
B3Propagator implements Propagator { @Override public <C> void inject(SpanContext spanContext, C carrier) { if (!(carrier instanceof TextMapInject)) { return; } TextMapInject textCarrier = (TextMapInject) carrier; long traceId = spanContext.getTraceId(); long spanId = spanContext.getSpanId(); String foreignTraceId = spanContext.getForeignTraceId(); if (foreignTraceId != null) { textCarrier.put(TRACE_ID_NAME, foreignTraceId); } else { textCarrier.put(TRACE_ID_NAME, Util.toHexString(traceId)); } textCarrier.put(SPAN_ID_NAME, Util.toHexString(spanId)); textCarrier.put(SAMPLED_NAME, "1"); }  @Override void inject(SpanContext spanContext, C carrier); @Override SpanContext extract(C carrier);  }### Answer:
@Test public void testInjectSampled() { B3Propagator undertest = new B3Propagator(); Map<String, String> headers = new HashMap<>(); SpanContext spanContext = new SpanContext(); undertest.inject(spanContext, new TextMapInjectAdapter(headers)); assertEquals(headers.get("X-B3-Sampled"), "1"); }