DocumentPermissions { public boolean areActionsAllowed(List<RequestedAction> actions) { boolean result = true; if (actions != null) { for (RequestedAction action : actions) { if (!isActionAllowed(action)) { result = false; break; } } } return result; } protected  DocumentPermissions(T document, User user); abstract void fillPermissions(T other, Map<RequestedAction, Boolean> permissions); abstract boolean isActionAllowed(RequestedAction action); boolean areActionsAllowed(List<RequestedAction> actions); void fillPermissions(); void fillPermissionsInOther(T other); Map<RequestedAction, Boolean> getPermissionMap(); List<RequestedAction> getAllAllowedActions(); boolean isAllowedToDownload(AttachmentContent attachment); boolean isAllowedToDownload(String attachmentContentId);  }
@Test @UseDataProvider("areActionsAllowedProvider") public void testAreActionsAllowed(List<RequestedAction> queriedPermissions, List<Boolean> singlePermissionResults, boolean expected) { DocumentPermissions<Object> perm = new TestDocumentPermissions<>(singlePermissionResults); boolean actual = perm.areActionsAllowed(queriedPermissions); assertThat(actual, is(expected)); }