ExtraFieldPropagation implements Propagation<K> { @Deprecated @Nullable public static String get(String name) { BaggageField field = BaggageField.getByName(validateFieldName(name)); if (field == null) return null; return field.getValue(); } ExtraFieldPropagation(Propagation<K> delegate, List<K> extraKeys); @Deprecated static Factory newFactory(Propagation.Factory delegate, String... names); @Deprecated static Factory newFactory(Propagation.Factory delegate,
    Collection<String> names); @Deprecated static FactoryBuilder newFactoryBuilder(Propagation.Factory delegate); @Deprecated @Nullable static String current(String name); @Deprecated @Nullable static String get(String name); @Deprecated static void set(String name, String value); @Deprecated static Map<String, String> getAll(); @Deprecated static Map<String, String> getAll(TraceContextOrSamplingFlags extracted); @Deprecated static Map<String, String> getAll(TraceContext context); @Deprecated @Nullable static String get(TraceContext context, String name); @Deprecated static void set(TraceContext context, String name, String value); @Deprecated List<K> extraKeys(); @Override List<K> keys(); @Override Injector<R> injector(Setter<R, K> setter); @Override Extractor<R> extractor(Getter<R, K> getter);  }
@Test public void get() { TraceContext context = extractWithAmazonTraceId(); assertThat(ExtraFieldPropagation.get(context, "x-amzn-trace-id")) .isEqualTo(awsTraceId); }
@Test public void get_null_if_not_extraField() { assertThat(ExtraFieldPropagation.get(context, "x-amzn-trace-id")) .isNull(); }
@Test public void current_get() { TraceContext context = extractWithAmazonTraceId(); try (Tracing t = Tracing.newBuilder().propagationFactory(factory).build(); Scope scope = t.currentTraceContext().newScope(context)) { assertThat(ExtraFieldPropagation.get("x-amzn-trace-id")) .isEqualTo(awsTraceId); } }
@Test public void current_get_null_if_no_current_context() { try (Tracing t = Tracing.newBuilder().propagationFactory(factory).build()) { assertThat(ExtraFieldPropagation.get("x-amzn-trace-id")) .isNull(); } }
@Test public void current_get_null_if_nothing_current() { assertThat(ExtraFieldPropagation.get("x-amzn-trace-id")) .isNull(); }