@Test
public void testHttpHeaderAuthenticationFilterUserIdWithDomainName() throws Exception
{

    modifyPropertySourceInEnvironment(getDefaultSecurityEnvironmentVariables());
    try
    {
        MockHttpServletRequest request =
            getRequestWithHeaders("testUser@company.com", "testFirstName", "testLastName", "testEmail", "testRole", "Wed, 11 Mar 2015 10:24:09");
        // Invalidate user session if exists.
        invalidateApplicationUser(request);
        httpHeaderAuthenticationFilter.init(new MockFilterConfig());
        httpHeaderAuthenticationFilter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain());
        validateHttpHeaderApplicationUser("testUser@company.com", "testFirstName", "testLastName", "testEmail", "testRole", "Wed, 11 Mar 2015 10:24:09",
            null, null);
    }
    finally
    {
        restorePropertySourceInEnvironment();
    }
}