ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable String getRequestUrl(@Nullable HttpServletRequest request) { if (request == null) { return null; } StringBuffer requestUrl = request.getRequestURL(); String queryString = request.getQueryString(); if (StringUtils.isNotBlank(queryString)) { requestUrl.append('?').append(queryString); } return requestUrl.toString(); }  @SuppressWarnings("unchecked") static ServletRequestTagAdapter getDefaultInstance(); @Override @Nullable String getErrorResponseTagValue(@Nullable HttpServletResponse response); @Override @Nullable String getRequestUrl(@Nullable HttpServletRequest request); @Override @Nullable Integer getResponseHttpStatus(@Nullable HttpServletResponse response); @Override @Nullable String getRequestHttpMethod(@Nullable HttpServletRequest request); @Override @Nullable String getRequestPath(@Nullable HttpServletRequest request); @Override @Nullable String getRequestUriPathTemplate(
        @Nullable HttpServletRequest request,
        @Nullable HttpServletResponse response
    ); @Override @Nullable String getHeaderSingleValue(@Nullable HttpServletRequest request, @NotNull String headerKey); @Override @Nullable List<String> getHeaderMultipleValue(
        @Nullable HttpServletRequest request, @NotNull String headerKey
    ); @Override @Nullable String getSpanHandlerTagValue(
        @Nullable HttpServletRequest request, @Nullable HttpServletResponse response
    );  }
@DataProvider(value = { "http: "http: "http: "http: }, splitBy = "\\|") @Test public void getRequestUrl_works_as_expected( String requestUrlNoQueryString, String queryString, String expectedResult ) { if ("[whitespace]".equals(queryString)) { queryString = " \t\r\n "; } StringBuffer requestUrlNoQueryStrBuffer = new StringBuffer(requestUrlNoQueryString); doReturn(requestUrlNoQueryStrBuffer).when(requestMock).getRequestURL(); doReturn(queryString).when(requestMock).getQueryString(); String result = adapterSpy.getRequestUrl(requestMock); assertThat(result).isEqualTo(expectedResult); }
@Test public void getRequestUrl_returns_null_if_passed_null() { assertThat(adapterSpy.getRequestUrl(null)).isNull(); }