LoggingContextRequestWrapper extends HttpServletRequestWrapper { @Override public AsyncContext startAsync() throws IllegalStateException { return new LoggingAsyncContextImpl(super.startAsync(), loggingVisitor); } LoggingContextRequestWrapper(HttpServletRequest request, RequestLogger loggingVisitor); @Override AsyncContext startAsync(); @Override AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse);  }
@Test public void wrapsAsyncContext() throws Exception { when(request.startAsync()).thenReturn(mock(AsyncContext.class)); LoggingContextRequestWrapper wrapper = new LoggingContextRequestWrapper(request, null); assertThat(wrapper.startAsync(), instanceOf(LoggingAsyncContextImpl.class)); }
@Test public void wrapsAsyncContextWithRequestResponseParameters() throws Exception { when(request.startAsync(request, response)).thenReturn(mock(AsyncContext.class)); LoggingContextRequestWrapper wrapper = new LoggingContextRequestWrapper(request, null); assertThat(wrapper.startAsync(request, response), instanceOf(LoggingAsyncContextImpl.class)); }