### Question:
PermissionsHelper { public boolean hasDatastreamAccess(AccessGroupSet principals, DatastreamType datastream, BriefObjectMetadata metadata) { notNull(principals, "Requires agent principals"); notNull(datastream, "Requires datastream type"); notNull(metadata, "Requires metadata object"); String dsIdentifier = datastream.getId(); if (metadata.getDatastreamObjects() == null || !containsDatastream(metadata, dsIdentifier)) { return false; } Permission permission = getPermissionForDatastream(datastream); return accessControlService.hasAccess(metadata.getPid(), principals, permission); } PermissionsHelper(); boolean hasOriginalAccess(AccessGroupSet principals, BriefObjectMetadata metadata); boolean hasThumbnailAccess(AccessGroupSet principals, BriefObjectMetadata metadata); boolean hasImagePreviewAccess(AccessGroupSet principals, BriefObjectMetadata metadata); boolean hasDescriptionAccess(AccessGroupSet principals, BriefObjectMetadata metadata); boolean hasDatastreamAccess(AccessGroupSet principals, DatastreamType datastream,
            BriefObjectMetadata metadata); boolean hasEditAccess(AccessGroupSet principals, BriefObjectMetadata metadata); boolean allowsPublicAccess(BriefObjectMetadata metadata); AccessControlService getAccessControlService(); void setAccessControlService(AccessControlService accessControlService);  }### Answer:
@Test public void testPermitOriginalAccess() { assignPermission(viewOriginal, true); assertTrue(helper.hasDatastreamAccess(principals, ORIGINAL_FILE, mdObject)); }
@Test public void testPermitDerivativeAccess() { assignPermission(viewAccessCopies, true); assertTrue(helper.hasDatastreamAccess(principals, JP2_ACCESS_COPY, mdObject)); }
@Test public void testDenyOriginalAccess() { assignPermission(viewOriginal, false); assertFalse(helper.hasDatastreamAccess(principals, ORIGINAL_FILE, mdObject)); }