@Test public void setupTracingCompletionWhenAsyncRequestCompletes_should_add_WingtipsRequestSpanCompletionAsyncListener( ) { AsyncContext asyncContextMock = mock(AsyncContext.class); doReturn(asyncContextMock).when(requestMock).getAsyncContext(); TracingState tracingStateMock = mock(TracingState.class); HttpTagAndSpanNamingStrategy<HttpServletRequest, HttpServletResponse> tagStrategyMock = mock(HttpTagAndSpanNamingStrategy.class); HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAdapterMock = mock(HttpTagAndSpanNamingAdapter.class); ArgumentCaptor<AsyncListener> listenerCaptor = ArgumentCaptor.forClass(AsyncListener.class); servlet3Runtime.setupTracingCompletionWhenAsyncRequestCompletes( requestMock, responseMock, tracingStateMock, tagStrategyMock, tagAdapterMock ); verify(asyncContextMock).addListener(listenerCaptor.capture(), eq(requestMock), eq(responseMock)); List<AsyncListener> addedListeners = listenerCaptor.getAllValues(); assertThat(addedListeners).hasSize(1); assertThat(addedListeners.get(0)).isInstanceOf(WingtipsRequestSpanCompletionAsyncListener.class); WingtipsRequestSpanCompletionAsyncListener listener = (WingtipsRequestSpanCompletionAsyncListener)addedListeners.get(0); assertThat(listener.originalRequestTracingState).isSameAs(tracingStateMock); assertThat(listener.tagAndNamingStrategy).isSameAs(tagStrategyMock); assertThat(listener.tagAndNamingAdapter).isSameAs(tagAdapterMock); }
abstract void setupTracingCompletionWhenAsyncRequestCompletes( HttpServletRequest asyncRequest, HttpServletResponse asyncResponse, TracingState originalRequestTracingState, HttpTagAndSpanNamingStrategy<HttpServletRequest,HttpServletResponse> tagAndNamingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAndNamingAdapter );
ServletRuntime { abstract void setupTracingCompletionWhenAsyncRequestCompletes( HttpServletRequest asyncRequest, HttpServletResponse asyncResponse, TracingState originalRequestTracingState, HttpTagAndSpanNamingStrategy<HttpServletRequest,HttpServletResponse> tagAndNamingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAndNamingAdapter ); }
ServletRuntime { abstract void setupTracingCompletionWhenAsyncRequestCompletes( HttpServletRequest asyncRequest, HttpServletResponse asyncResponse, TracingState originalRequestTracingState, HttpTagAndSpanNamingStrategy<HttpServletRequest,HttpServletResponse> tagAndNamingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAndNamingAdapter );  }
ServletRuntime { abstract void setupTracingCompletionWhenAsyncRequestCompletes( HttpServletRequest asyncRequest, HttpServletResponse asyncResponse, TracingState originalRequestTracingState, HttpTagAndSpanNamingStrategy<HttpServletRequest,HttpServletResponse> tagAndNamingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAndNamingAdapter );   }
ServletRuntime { abstract void setupTracingCompletionWhenAsyncRequestCompletes( HttpServletRequest asyncRequest, HttpServletResponse asyncResponse, TracingState originalRequestTracingState, HttpTagAndSpanNamingStrategy<HttpServletRequest,HttpServletResponse> tagAndNamingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest,HttpServletResponse> tagAndNamingAdapter );    }