ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable List<String> getHeaderMultipleValue( @Nullable HttpServletRequest request, @NotNull String headerKey ) { if (request == null) { return null; } Enumeration<String> matchingHeadersEnum = request.getHeaders(headerKey); if (matchingHeadersEnum == null) { return null; } return Collections.list(matchingHeadersEnum); }  @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
    );  }
@Test public void getHeaderMultipleValue_works_as_expected() { String headerKey = UUID.randomUUID().toString(); List<String> expectedResult = Arrays.asList(UUID.randomUUID().toString(), UUID.randomUUID().toString()); doReturn(Collections.enumeration(expectedResult)).when(requestMock).getHeaders(anyString()); List<String> result = adapterSpy.getHeaderMultipleValue(requestMock, headerKey); assertThat(result).isEqualTo(expectedResult); verify(requestMock).getHeaders(headerKey); }
@Test public void getHeaderMultipleValue_returns_null_if_request_headers_Enumeration_is_null() { String headerKey = UUID.randomUUID().toString(); doReturn(null).when(requestMock).getHeaders(anyString()); List<String> result = adapterSpy.getHeaderMultipleValue(requestMock, headerKey); assertThat(result).isNull(); verify(requestMock).getHeaders(headerKey); }
@Test public void getHeaderMultipleValue_returns_null_if_passed_null_request() { assertThat(adapterSpy.getHeaderMultipleValue(null, "foo")).isNull(); }