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

    System.setProperty(SegmentNamingStrategy.NAME_OVERRIDE_SYSTEM_PROPERTY_KEY, "pass");
    AWSXRayServletFilter servletFilter = new AWSXRayServletFilter("fail");
    HttpServletRequest request = mock(HttpServletRequest.class);
    when(request.getRequestURL()).thenReturn(new StringBuffer("test_url"));
    when(request.getMethod()).thenReturn("TEST_METHOD");
    when(request.isAsyncStarted()).thenReturn(false);
    HttpServletResponse response = mock(HttpServletResponse.class);
    FilterChain chain = mock(FilterChain.class);
    servletFilter.doFilter(request, response, chain);
    ArgumentCaptor<Segment> emittedSegment = ArgumentCaptor.forClass(Segment.class);
    verify(AWSXRay.getGlobalRecorder().getEmitter(), Mockito.times(1)).sendSegment(emittedSegment.capture());
    Assert.assertEquals("pass", emittedSegment.getValue().getName());
}