@Test
  public void testAccessControlRevokeOnlyFewPermission() throws Throwable {
    TableName tname = TableName.valueOf("revoke");
    try {
      TEST_UTIL.createTable(tname, TEST_FAMILY);
      User testUserPerms = User.createUserForTesting(conf, "revokePerms", new String[0]);
      Permission.Action[] actions = { Action.READ, Action.WRITE };
      AccessControlClient.grant(TEST_UTIL.getConnection(), tname, testUserPerms.getShortName(),
        null, null, actions);

      List<UserPermission> userPermissions =
        AccessControlClient.getUserPermissions(TEST_UTIL.getConnection(), tname.getNameAsString());
      assertEquals(2, userPermissions.size());

      AccessControlClient.revoke(TEST_UTIL.getConnection(), tname, testUserPerms.getShortName(),
        null, null, Action.WRITE);

      userPermissions =
        AccessControlClient.getUserPermissions(TEST_UTIL.getConnection(), tname.getNameAsString());
      assertEquals(2, userPermissions.size());

      Permission.Action[] expectedAction = { Action.READ };
      boolean userFound = false;
      for (UserPermission p : userPermissions) {
        if (testUserPerms.getShortName().equals(p.getUser())) {
          assertArrayEquals(expectedAction, p.getPermission().getActions());
          userFound = true;
          break;
        }
      }
      assertTrue(userFound);
    } finally {
      TEST_UTIL.deleteTable(tname);
    }
  }
List all user permissions match the given regular expression for namespace and verify each of
them.
@param namespaceRegexWithoutPrefix the regualar expression for namespace, without
                                   NAMESPACE_PREFIX
@param expectedAmount              the expected amount of user permissions returned
@param expectedNamespace           the expected namespace of each user permission returned
@throws HBaseException in the case of any HBase exception when accessing hbase:acl table
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java