### Question:
JcrSecurityRoleProvider implements SecurityRoleProvider { @Override public SecurityRole createRole(String entityName, String roleName, String title, String descr) { Session session = JcrMetadataAccess.getActiveSession(); Path rolePath = SecurityPaths.rolePath(entityName, roleName); if (JcrUtil.hasNode(session, rolePath.toString())) { throw new SecurityRoleAlreadyExistsException(entityName, roleName); } else { if (! JcrUtil.hasNode(session, rolePath.getParent().toString())) { throw new RoleNotFoundException("No role entity found with the specified name: " + entityName); } Node entityNode = JcrUtil.getNode(session, rolePath.getParent().toString()); JcrSecurityRole role = JcrUtil.getOrCreateNode(entityNode, roleName, JcrSecurityRole.NODE_TYPE, JcrSecurityRole.class); role.setTitle(title == null ? roleName : title); role.setDescription(descr); return role; } }  @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 testCreateRole() { String name = metadata.commit(() -> { SecurityRole role = createRole("feedEditor", "Editor", "Can edit feeds", FeedAccessControl.EDIT_DETAILS, FeedAccessControl.ENABLE_DISABLE, FeedAccessControl.EXPORT); assertThat(role).isNotNull().extracting("systemName", "title", "description").contains("feedEditor", "Editor", "Can edit feeds"); assertThat(role.getAllowedActions().getAvailableActions().stream().flatMap(action -> action.stream())) .extracting("systemName") .contains(FeedAccessControl.ACCESS_DETAILS.getSystemName(), FeedAccessControl.EDIT_DETAILS.getSystemName(), FeedAccessControl.ENABLE_DISABLE.getSystemName(), FeedAccessControl.EXPORT.getSystemName()); return role.getSystemName(); }, MetadataAccess.SERVICE); }