ExtraFieldPropagation implements Propagation<K> { @Deprecated public static Factory newFactory(Propagation.Factory delegate, String... names) { if (delegate == null) throw new NullPointerException("delegate == null"); if (names == null) throw new NullPointerException("names == null"); return newFactory(delegate, Arrays.asList(names)); } 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 downcasesNames() { ExtraFieldPropagation.Factory factory = ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, "X-FOO"); assertThat(factory.extraKeyNames).containsExactly("x-foo"); }
@Test public void trimsNames() { ExtraFieldPropagation.Factory factory = ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, " x-foo "); assertThat(factory.extraKeyNames).containsExactly("x-foo"); }
@Test(expected = NullPointerException.class) public void rejectsNull() { ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, "x-me", null); }
@Test(expected = IllegalArgumentException.class) public void rejectsEmpty() { ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, "x-me", " "); }
@Test public void noFields_newFactory_disallowed() { assertThatThrownBy(() -> ExtraFieldPropagation.newFactory(B3Propagation.FACTORY)) .hasMessage("no field names"); assertThatThrownBy(() -> ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, asList())) .hasMessage("no field names"); }