ApacheHttpClientTagAdapter extends HttpTagAndSpanNamingAdapter<HttpRequest, HttpResponse> { @Override public @Nullable String getRequestUrl(@Nullable HttpRequest request) { if (request == null) { return null; } String uri = request.getRequestLine().getUri(); if (request instanceof HttpRequestWrapper && uri.startsWith("/")) { HttpRequestWrapper wrapper = (HttpRequestWrapper) request; HttpHost target = wrapper.getTarget(); if (target != null) { uri = wrapper.getTarget().toURI() + uri; } } return uri; }  @SuppressWarnings("unchecked") static ApacheHttpClientTagAdapter getDefaultInstance(); @Override @Nullable String getRequestPath(@Nullable HttpRequest request); @Override @Nullable Integer getResponseHttpStatus(@Nullable HttpResponse response); @Override @Nullable String getRequestHttpMethod(@Nullable HttpRequest request); @Override @Nullable String getRequestUriPathTemplate(@Nullable HttpRequest request, @Nullable HttpResponse response); @Override @Nullable String getRequestUrl(@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 HttpResponse response);  }
@DataProvider(value = { "REQUEST_OBJ_IS_NULL", "REQUEST_OBJ_IS_NOT_WRAPPER", "REQUEST_IS_WRAPPER_BUT_DOES_NOT_START_WITH_SLASH", "REQUEST_IS_WRAPPER_AND_STARTS_WITH_SLASH_BUT_TARGET_IS_NULL", "REQUEST_IS_WRAPPER_AND_STARTS_WITH_SLASH_AND_TARGET_HAS_URI" }) @Test public void getRequestUrl_works_as_expected(GetRequestUrlScenario scenario) { String result = implSpy.getRequestUrl(scenario.requestMock); assertThat(result).isEqualTo(scenario.expectedResult); }