@Test
public void testSerializePrivilegesByRole() throws Exception {

  AccessControlList acl = new AccessControlList();
  acl.getEntries().add(ACE_ROLE_ADMIN_ALLOW_ACTION_READ);
  acl.getEntries().add(ACE_ROLE_ADMIN_ALLOW_ACTION_WRITE);
  acl.getEntries().add(ACE_ROLE_STUDENT_ALLOW_ACTION_READ);
  acl.getEntries().add(ACE_ROLE_STUDENT_DISALLOW_ACTION_WRITE);
  JSONObject privilegesByRole = AccessInformationUtil.serializePrivilegesByRole(acl);
  assertTrue(privilegesByRole.getJSONObject(ROLE_ADMIN).getBoolean(ACTION_READ));
  assertTrue(privilegesByRole.getJSONObject(ROLE_ADMIN).getBoolean(ACTION_WRITE));
  assertTrue(privilegesByRole.getJSONObject(ROLE_STUDENT).getBoolean(ACTION_READ));
  assertFalse(privilegesByRole.getJSONObject(ROLE_STUDENT).getBoolean(ACTION_WRITE));
}