Search in sources :

Example 1 with StrictNoTransfer

use of example.nontransferable.StrictNoTransfer in project elide by yahoo.

the class PersistentResourceTest method testNoTransferStrictPermissionFailure.

@Test
public void testNoTransferStrictPermissionFailure() {
    StrictNoTransfer a = new StrictNoTransfer();
    a.setId(1);
    StrictNoTransfer b = new StrictNoTransfer();
    b.setId(2);
    StrictNoTransfer c = new StrictNoTransfer();
    c.setId(3);
    a.setOther(b);
    b.setOther(c);
    RequestScope goodScope = buildRequestScope(tx, goodUser);
    PersistentResource aResource = new PersistentResource(a, "1", goodScope);
    PersistentResource bResource = new PersistentResource(b, aResource, "other", "2", goodScope);
    PersistentResource cResource = new PersistentResource(c, bResource, "other", "3", goodScope);
    assertThrows(ForbiddenAccessException.class, () -> cResource.addRelation("other", bResource));
}
Also used : StrictNoTransfer(example.nontransferable.StrictNoTransfer) PatchRequestScope(com.yahoo.elide.jsonapi.extensions.PatchRequestScope) Test(org.junit.jupiter.api.Test)

Aggregations

PatchRequestScope (com.yahoo.elide.jsonapi.extensions.PatchRequestScope)1 StrictNoTransfer (example.nontransferable.StrictNoTransfer)1 Test (org.junit.jupiter.api.Test)1