@Test
public void testHttpHeaderAuthenticationFilterUserWithMultiRoleHeaderNameRegexMultiRoles() throws Exception
{

    String testUserId = "testUser";
    String userIdSuffix = "suffix";
    String userIdWithSuffix = testUserId + "@" + userIdSuffix;
    modifyPropertySourceInEnvironment(getDefaultSecurityEnvironmentVariablesWithMultiHeaderRoles());
    try
    {
        MockHttpServletRequest request = getRequestWithHeaders(testUserId, "testFirstName", "testLastName", "testEmail", "", "Wed, 11 Mar 2015 10:24:09");
        request.addHeader("privtestrole1", "valid");
        request.addHeader("privtestrole2", "valid");
        request.addHeader("useridSuffix", userIdSuffix);
        // Invalidate user session if exists.
        invalidateApplicationUser(request);
        httpHeaderAuthenticationFilter.init(new MockFilterConfig());
        httpHeaderAuthenticationFilter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain());
        Set<String> expectedRoles = new HashSet<>();
        expectedRoles.add("testrole1");
        expectedRoles.add("testrole2");
        validateHttpHeaderApplicationUser(userIdWithSuffix, "testFirstName", "testLastName", "testEmail", expectedRoles, "Wed, 11 Mar 2015 10:24:09", null,
            null);
    }
    finally
    {
        restorePropertySourceInEnvironment();
    }
}