AccessInformationUtil { public static JSONObject serializeManagedAcl(ManagedAcl managedAcl) { if (managedAcl == null) throw new IllegalArgumentException("The parameter managedAcl must not be null"); JSONObject systemAclJson = new JSONObject(); try { systemAclJson.put("id", managedAcl.getId()); systemAclJson.put("name", managedAcl.getName()); } catch (JSONException e) { logger.error("An unexpected error occured:", e); } return systemAclJson; } private  AccessInformationUtil(); static JSONObject serializeManagedAcl(ManagedAcl managedAcl); static JSONObject serializePrivilegesByRole(AccessControlList acl); static Option<ManagedAcl> matchAcls(List<ManagedAcl> acls, final AccessControlList acl);  }
@Test public void testSerializeManagedAcl() throws Exception { AccessControlList acl = new AccessControlList(); acl.getEntries().add(ACE_ROLE_ADMIN_ALLOW_ACTION_READ); ManagedAcl manAcl = new ManagedAclImpl(1L, MANAGED_ACL_1_NAME, ORGANISATION_1_ID, acl); JSONObject aclJson = AccessInformationUtil.serializeManagedAcl(manAcl); assertEquals(1L, aclJson.getLong("id")); assertEquals(MANAGED_ACL_1_NAME, aclJson.getString("name")); }
@Test(expected = IllegalArgumentException.class) public void testSerializeManagedAclWithNull() throws Exception { AccessInformationUtil.serializeManagedAcl(null); }