@Test
  public void testUnauthorizedSetRegionStateInMeta() throws Exception {
    Admin admin = TEST_UTIL.getAdmin();
    final List<RegionInfo> regions = admin.getRegions(TEST_TABLE);
    RegionInfo closeRegion = regions.get(0);
    Map<String, RegionState.State> newStates = new HashMap<>();
    newStates.put(closeRegion.getEncodedName(), RegionState.State.CLOSED);
    AccessTestAction action = () -> {
      try (Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
        Hbck hbck = conn.getHbck()) {
        hbck.setRegionStateInMeta(newStates);
      }
      return null;
    };

    verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,
      USER_GROUP_WRITE, USER_GROUP_CREATE);
  }
The systemUserConnection created here is tied to the system user. In case, you are planning to
create AccessTestAction, DON'T use this systemUserConnection as the 'doAs' user gets eclipsed
by the system user.
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java