public void checkMultimapEqual(ListMultimap<String, UserPermission> first,
    ListMultimap<String, UserPermission> second) {
    assertEquals(first.size(), second.size());
    for (String key : first.keySet()) {
      List<UserPermission> firstPerms = first.get(key);
      List<UserPermission> secondPerms = second.get(key);
      assertNotNull(secondPerms);
      assertEquals(firstPerms.size(), secondPerms.size());
      LOG.info("First permissions: " + firstPerms.toString());
      LOG.info("Second permissions: " + secondPerms.toString());
      for (UserPermission p : firstPerms) {
        assertTrue("Permission " + p.toString() + " not found", secondPerms.contains(p));
      }
    }
  }
The PermissionStorage.addUserPermission may throw exception before closing the table.
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java