BaggageField { @Nullable public String getValue(@Nullable TraceContext context) { if (context == null) return null; return this.context.getValue(this, context); } BaggageField(String name, BaggageContext context); static BaggageField create(String name); @Deprecated static List<BaggageField> getAll(@Nullable TraceContext context); @Deprecated static List<BaggageField> getAll(TraceContextOrSamplingFlags extracted); @Deprecated @Nullable static List<BaggageField> getAll(); static Map<String, String> getAllValues(@Nullable TraceContext context); static Map<String, String> getAllValues(TraceContextOrSamplingFlags extracted); @Nullable static Map<String, String> getAllValues(); @Nullable static BaggageField getByName(@Nullable TraceContext context, String name); @Nullable static BaggageField getByName(TraceContextOrSamplingFlags extracted,
      String name); @Nullable static BaggageField getByName(String name); final String name(); @Nullable String getValue(@Nullable TraceContext context); @Nullable String getValue(); @Nullable String getValue(TraceContextOrSamplingFlags extracted); boolean updateValue(@Nullable TraceContext context, @Nullable String value); boolean updateValue(TraceContextOrSamplingFlags extracted, @Nullable String value); boolean updateValue(String value); @Override String toString(); @Override final boolean equals(Object o); @Override final int hashCode();  }
@Test public void getValue_current_nothingCurrent() { assertThat(AMZN_TRACE_ID.getValue()) .isNull(); }
@Test public void getValue_context_exists() { assertThat(REQUEST_ID.getValue(requestIdContext)) .isEqualTo(requestId); }
@Test public void getValue_context_doesntExist() { assertThat(AMZN_TRACE_ID.getValue(requestIdContext)) .isNull(); assertThat(AMZN_TRACE_ID.getValue(emptyContext)) .isNull(); assertThat(AMZN_TRACE_ID.getValue(context)) .isNull(); }
@Test public void getValue_context_null() { assertThat(REQUEST_ID.getValue((TraceContext) null)) .isNull(); }
@Test public void getValue_extracted_exists() { assertThat(REQUEST_ID.getValue(requestIdExtraction)) .isEqualTo(requestId); }
@Test public void getValue_extracted_doesntExist() { assertThat(AMZN_TRACE_ID.getValue(requestIdExtraction)) .isNull(); assertThat(AMZN_TRACE_ID.getValue(emptyExtraction)) .isNull(); assertThat(AMZN_TRACE_ID.getValue(TraceContextOrSamplingFlags.EMPTY)) .isNull(); }
@Test public void getValue_extracted_invalid() { assertThatThrownBy(() -> REQUEST_ID.getValue((TraceContextOrSamplingFlags) null)) .isInstanceOf(NullPointerException.class); }