SpringHttpClientTagAdapter extends HttpTagAndSpanNamingAdapter<HttpRequest, ClientHttpResponse> { @Override public @Nullable String getHeaderSingleValue(@Nullable HttpRequest request, @NotNull String headerKey) { if (request == null) { return null; } return request.getHeaders().getFirst(headerKey); }  @SuppressWarnings("unchecked") static SpringHttpClientTagAdapter getDefaultInstance(); @Override @Nullable String getRequestUrl(@Nullable HttpRequest request); @Override @Nullable Integer getResponseHttpStatus(@Nullable ClientHttpResponse response); @Override @Nullable String getRequestHttpMethod(@Nullable HttpRequest request); @Override @Nullable String getRequestUriPathTemplate(
        @Nullable HttpRequest request,
        @Nullable ClientHttpResponse response
    ); @Override @Nullable String getRequestPath(@Nullable HttpRequest request); @Override @Nullable String getHeaderSingleValue(@Nullable HttpRequest request, @NotNull String headerKey); @Override @Nullable List<String> getHeaderMultipleValue(@Nullable HttpRequest request, @NotNull String headerKey); @Override @Nullable String getSpanHandlerTagValue(@Nullable HttpRequest request, @Nullable ClientHttpResponse response);  }
@Test public void getHeaderSingleValue_returns_result_of_calling_request_headers_getFirst() { String expectedHeaderValue = UUID.randomUUID().toString(); String headerKey = UUID.randomUUID().toString(); HttpHeaders headersMock = mock(HttpHeaders.class); doReturn(headersMock).when(requestMock).getHeaders(); doReturn(expectedHeaderValue).when(headersMock).getFirst(headerKey); String result = implSpy.getHeaderSingleValue(requestMock, headerKey); assertThat(result).isEqualTo(expectedHeaderValue); verify(headersMock).getFirst(headerKey); }
@Test public void getHeaderSingleValue_returns_null_when_passed_null_request() { assertThat(implSpy.getHeaderSingleValue(null, "foo")).isNull(); }