@Test
public void anyAuthenticator() throws Exception {

    Object[] testData = new Object[]{
        "service-any", new boolean[]{true, false}, true,
        "service-all", new boolean[]{true, false}, false,
        "service-any", new boolean[]{true, true}, true,
        "service-all", new boolean[]{true, true}, true,
        "service-any", new boolean[]{false, false}, false,
        "service-all", new boolean[]{false, false}, false,
        "service-any", new boolean[]{false, true}, true,
        "service-all", new boolean[]{false, true}, false,
        "service-all", new boolean[]{true, true, true, true, false, true}, false,
        "service-any", new boolean[]{false, false, false, false, false, true}, true
    };
    for (int i = 0; i < testData.length; i += 3) {
        BundleContext bundleContext = createBundleContext();
        ServiceReference[] serviceRefs = createServiceReferences(bundleContext, (boolean[]) testData[i + 1]);
        expect(bundleContext.getServiceReferences(eq(Authenticator.class.getName()), (String) isNull())).andReturn(serviceRefs);
        replay(bundleContext);
        ServiceAuthenticationHttpContext ctx = createContext(bundleContext, (String) testData[i]);
        HttpServletResponse resp = prepareResponse();
        assertEquals(ctx.handleSecurity(null, resp), testData[i + 2],
                     String.format("%s: %s --> %s", testData[i], printBooleanList((boolean[]) testData[i + 1]), testData[i + 2]));
    }
}