@Test
  public void testCustomQueryWithGroupsPositive() {
    testCase = defaultBuilder()
        .baseDN("dc=example,dc=com")
        .userDNPatterns(
            "cn=%s,ou=People,dc=example,dc=com",
            "uid=%s,ou=People,dc=example,dc=com")
        .customQuery(
            String.format("(&(objectClass=groupOfNames)(|(cn=%s)(cn=%s)))",
                GROUP1_NAME,
                GROUP2_NAME))
        .build();

    testCase.assertAuthenticatePasses(USER1.credentialsWithId());
    testCase.assertAuthenticatePasses(USER1.credentialsWithDn());
    testCase.assertAuthenticatePasses(USER2.credentialsWithId());
    testCase.assertAuthenticatePasses(USER2.credentialsWithDn());

    /* the following test uses a query that returns a group and a user entry.
       the ldap atn should use the groupMembershipKey to identify the users for the returned group
       and the authentication should succeed for the users of that group as well as the lone user4 in this case
    */
    testCase = defaultBuilder()
        .baseDN("dc=example,dc=com")
        .userDNPatterns(
            "cn=%s,ou=People,dc=example,dc=com",
            "uid=%s,ou=People,dc=example,dc=com")
        .customQuery(
            String.format("(|(&(objectClass=groupOfNames)(cn=%s))(&(objectClass=person)(sn=%s)))",
                GROUP1_NAME,
                USER4.getId()))
        .build();

    testCase.assertAuthenticatePasses(USER1.credentialsWithId());
    testCase.assertAuthenticatePasses(USER1.credentialsWithDn());
    testCase.assertAuthenticatePasses(USER4.credentialsWithId());
    testCase.assertAuthenticatePasses(USER4.credentialsWithDn());


    testCase = defaultBuilder()
        .baseDN("dc=example,dc=com")
        .userDNPatterns(
            "cn=%s,ou=People,dc=example,dc=com",
            "uid=%s,ou=People,dc=example,dc=com")
        .groupMembershipKey("uniqueMember")
        .customQuery(
            String.format("(&(objectClass=groupOfUniqueNames)(cn=%s))",
                GROUP4_NAME))
        .build();

    testCase.assertAuthenticatePasses(USER4.credentialsWithId());
    testCase.assertAuthenticatePasses(USER4.credentialsWithDn());
  }
Test to test the LDAP Atn to use a custom LDAP query that returns
   a) A set of group DNs
   b) A combination of group(s) DN and user DN
   LDAP atn is expected to extract the members of the group using the attribute value for
   "hive.server2.authentication.ldap.groupMembershipKey"
service/src/test/org/apache/hive/service/auth/TestLdapAtnProviderWithMiniDS.java