use of com.yahoo.elide.annotation.DeletePermission in project elide by yahoo.
the class PermissionExecutorTest method testDeleteCheckExpressionForNewlyCreatedObject.
@Test
public void testDeleteCheckExpressionForNewlyCreatedObject() {
@Entity
@Include(rootLevel = false)
@DeletePermission(expression = "FailOp")
class Model {
}
PersistentResource resource = newResource(new Model(), Model.class, true);
RequestScope requestScope = resource.getRequestScope();
requestScope.getDictionary().bindEntity(Model.class);
assertEquals(ExpressionResult.DEFERRED, requestScope.getPermissionExecutor().checkPermission(DeletePermission.class, resource));
assertThrows(ForbiddenAccessException.class, () -> requestScope.getPermissionExecutor().executeCommitChecks());
}
Aggregations