use of example.nontransferable.Untransferable in project elide by yahoo.
the class PersistentResourceTest method testTransferPermissionErrorOnUpdateRelationshipPackageLevel.
@Test
public void testTransferPermissionErrorOnUpdateRelationshipPackageLevel() {
ContainerWithPackageShare containerWithPackageShare = new ContainerWithPackageShare();
Untransferable untransferable = new Untransferable();
untransferable.setContainerWithPackageShare(containerWithPackageShare);
List<Resource> unShareableList = new ArrayList<>();
unShareableList.add(new ResourceIdentifier("untransferable", "1").castToResource());
Relationship unShareales = new Relationship(null, new Data<>(unShareableList));
when(tx.loadObject(any(), eq(1L), any())).thenReturn(untransferable);
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<ContainerWithPackageShare> containerResource = new PersistentResource<>(containerWithPackageShare, goodScope.getUUIDFor(containerWithPackageShare), goodScope);
assertThrows(ForbiddenAccessException.class, () -> containerResource.updateRelation("untransferables", unShareales.toPersistentResources(goodScope)));
}
Aggregations