SpringHttpClientTagAdapter extends HttpTagAndSpanNamingAdapter<HttpRequest, ClientHttpResponse> { @Override public @Nullable String getSpanHandlerTagValue(@Nullable HttpRequest request, @Nullable ClientHttpResponse response) { if (request instanceof HttpRequestWrapper) { request = ((HttpRequestWrapper) request).getRequest(); } if (request instanceof AsyncClientHttpRequest) { return "spring.asyncresttemplate"; } return "spring.resttemplate"; }  @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);  }
@DataProvider(value = { "true | spring.asyncresttemplate", "false | spring.resttemplate" }, splitBy = "\\|") @Test public void getSpanHandlerTagValue_works_as_expected_when_request_is_not_an_HttpRequestWrapper( boolean requestIsAsyncClientHttpRequest, String expectedResult ) { HttpRequest request = (requestIsAsyncClientHttpRequest) ? mock(AsyncClientHttpRequest.class) : mock(HttpRequest.class); String result = implSpy.getSpanHandlerTagValue(request, responseMock); assertThat(result).isEqualTo(expectedResult); }
@DataProvider(value = { "true | spring.asyncresttemplate", "false | spring.resttemplate" }, splitBy = "\\|") @Test public void getSpanHandlerTagValue_works_as_expected_when_request_is_an_HttpRequestWrapper( boolean wrappedRequestIsAsyncClientHttpRequest, String expectedResult ) { HttpRequestWrapper request = mock(HttpRequestWrapper.class); HttpRequest wrappedRequest = (wrappedRequestIsAsyncClientHttpRequest) ? mock(AsyncClientHttpRequest.class) : mock(HttpRequest.class); doReturn(wrappedRequest).when(request).getRequest(); String result = implSpy.getSpanHandlerTagValue(request, responseMock); assertThat(result).isEqualTo(expectedResult); }