}
public void testPermissions() {
Authorization authorization = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
assertEquals(1, authorization.getPermissions(Permissions.values()).length);
assertFalse(authorization.isPermissionGranted(ACCESS));
assertFalse(authorization.isPermissionGranted(DELETE));
assertFalse(authorization.isPermissionGranted(READ));
assertFalse(authorization.isPermissionGranted(UPDATE));
authorization.addPermission(ACCESS);
assertTrue(authorization.isPermissionGranted(ACCESS));
assertFalse(authorization.isPermissionGranted(DELETE));
assertFalse(authorization.isPermissionGranted(READ));
assertFalse(authorization.isPermissionGranted(UPDATE));
authorization.addPermission(DELETE);
assertTrue(authorization.isPermissionGranted(ACCESS));
assertTrue(authorization.isPermissionGranted(DELETE));
assertFalse(authorization.isPermissionGranted(READ));
assertFalse(authorization.isPermissionGranted(UPDATE));
authorization.addPermission(READ);
assertTrue(authorization.isPermissionGranted(ACCESS));
assertTrue(authorization.isPermissionGranted(DELETE));
assertTrue(authorization.isPermissionGranted(READ));
assertFalse(authorization.isPermissionGranted(UPDATE));
authorization.addPermission(UPDATE);
assertTrue(authorization.isPermissionGranted(ACCESS));
assertTrue(authorization.isPermissionGranted(DELETE));
assertTrue(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(UPDATE));
authorization.removePermission(ACCESS);
assertFalse(authorization.isPermissionGranted(ACCESS));
assertTrue(authorization.isPermissionGranted(DELETE));
assertTrue(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(UPDATE));
authorization.removePermission(DELETE);
assertFalse(authorization.isPermissionGranted(ACCESS));
assertFalse(authorization.isPermissionGranted(DELETE));
assertTrue(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(UPDATE));
authorization.removePermission(READ);
assertFalse(authorization.isPermissionGranted(ACCESS));
assertFalse(authorization.isPermissionGranted(DELETE));
assertFalse(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(UPDATE));
authorization.removePermission(UPDATE);
assertFalse(authorization.isPermissionGranted(ACCESS));
assertFalse(authorization.isPermissionGranted(DELETE));
assertFalse(authorization.isPermissionGranted(READ));
assertFalse(authorization.isPermissionGranted(UPDATE));
}