SpanCustomizingAsyncHandlerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) { Object span = request.getAttribute(SpanCustomizer.class.getName()); if (span instanceof SpanCustomizer) handlerParser.preHandle(request, o, (SpanCustomizer) span); return true; } SpanCustomizingAsyncHandlerInterceptor(); @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o); @Override void afterCompletion(
    HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex);  }
@Test public void preHandle_parses() { when(request.getAttribute("brave.SpanCustomizer")).thenReturn(span); interceptor.preHandle(request, response, controller); verify(request).getAttribute("brave.SpanCustomizer"); verify(parser).preHandle(request, controller, span); verifyNoMoreInteractions(request, response, parser, span); }
@Test public void preHandle_nothingWhenNoSpanAttribute() { interceptor.preHandle(request, response, controller); verify(request).getAttribute("brave.SpanCustomizer"); verifyNoMoreInteractions(request, request, parser, span); }