@Test
  public void testSerialization() throws Exception {
    Configuration conf = UTIL.getConfiguration();
    ListMultimap<String, UserPermission> permissions = createPermissions();
    byte[] permsData = PermissionStorage.writePermissionsAsBytes(permissions, conf);

    ListMultimap<String, UserPermission> copy =
      PermissionStorage.readUserPermission(permsData, conf);

    checkMultimapEqual(permissions, copy);
  }
The PermissionStorage.addUserPermission may throw exception before closing the table.
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java