### Question:
JcrSecurityRoleProvider implements SecurityRoleProvider { @Override public Optional<SecurityRole> setPermissions(String entityName, String roleName, Action... actions) { return setPermissions(entityName, roleName, Arrays.asList(actions)); }  @Override SecurityRole createRole(String entityName, String roleName, String title, String descr); @Override Map<String, List<SecurityRole>> getRoles(); @Override List<SecurityRole> getEntityRoles(String entityName); @Override Optional<SecurityRole> getRole(String entityName, String roleName); @Override boolean removeRole(String entityName, String roleName); @Override Optional<SecurityRole> setPermissions(String entityName, String roleName, Action... actions); @Override Optional<SecurityRole> setPermissions(String entityName, String roleName, Collection<Action> actions);  }### Answer:
@Test public void testSetPermissions() { metadata.commit(() -> { createRole("feedEditor", "Editor", "Can edit feeds", FeedAccessControl.ACCESS_FEED); }, MetadataAccess.SERVICE); metadata.commit(() -> { Optional<SecurityRole> option = this.provider.getRole(SecurityRole.FEED, "feedEditor"); assertThat(option.get().getAllowedActions().getAvailableActions().stream().flatMap(action -> action.stream())) .extracting("systemName") .contains(FeedAccessControl.ACCESS_FEED.getSystemName()) .doesNotContain(FeedAccessControl.EDIT_DETAILS.getSystemName()); this.provider.setPermissions(SecurityRole.FEED, "feedEditor", FeedAccessControl.EDIT_DETAILS, FeedAccessControl.EXPORT); }, MetadataAccess.SERVICE); metadata.read(() -> { Optional<SecurityRole> option = this.provider.getRole(SecurityRole.FEED, "feedEditor"); assertThat(option.get().getAllowedActions().getAvailableActions().stream().flatMap(action -> action.stream())) .extracting("systemName") .contains(FeedAccessControl.ACCESS_FEED.getSystemName(), FeedAccessControl.ACCESS_DETAILS.getSystemName(), FeedAccessControl.EDIT_DETAILS.getSystemName(), FeedAccessControl.EXPORT.getSystemName()) .doesNotContain(FeedAccessControl.ENABLE_DISABLE.getSystemName()); }, MetadataAccess.SERVICE); }