@Test
public void testAsyncServletRequestHasListenerAdded() throws IOException, ServletException {

    AWSXRayServletFilter servletFilter = new AWSXRayServletFilter("test");
    AsyncContext asyncContext = mock(AsyncContext.class);
    HttpServletRequest request = mock(HttpServletRequest.class);
    when(request.getRequestURL()).thenReturn(new StringBuffer("test_url"));
    when(request.getMethod()).thenReturn("TEST_METHOD");
    when(request.isAsyncStarted()).thenReturn(true);
    when(request.getAsyncContext()).thenReturn(asyncContext);
    HttpServletResponse response = mock(HttpServletResponse.class);
    FilterChain chain = mock(FilterChain.class);
    servletFilter.doFilter(request, response, chain);
    verify(asyncContext, Mockito.times(1)).addListener(Mockito.any());
}