### Question:
JcrSecurityRoleProvider implements SecurityRoleProvider { @Override public boolean removeRole(String entityName, String roleName) { Session session = JcrMetadataAccess.getActiveSession(); Path rolePath = SecurityPaths.rolePath(entityName, roleName); if (JcrUtil.hasNode(session, rolePath.toString())) { Node entityNode = JcrUtil.getNode(session, rolePath.getParent().toString()); return JcrUtil.removeNode(entityNode, roleName); } else { if (! JcrUtil.hasNode(session, rolePath.getParent().toString())) { throw new RoleNotFoundException("No role entity found with the specified name: " + entityName); } return false; } }  @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 testRemoveRole() { metadata.commit(() -> { createRole("feedEditor", "Editor", "Can edit feeds", FeedAccessControl.EDIT_DETAILS, FeedAccessControl.ENABLE_DISABLE, FeedAccessControl.EXPORT); }, MetadataAccess.SERVICE); boolean deleted = metadata.commit(() -> { return this.provider.removeRole(SecurityRole.FEED, "feedEditor"); }, MetadataAccess.SERVICE); assertThat(deleted).isTrue(); metadata.read(() -> { Optional<SecurityRole> option = this.provider.getRole(SecurityRole.FEED, "feedEditor"); assertThat(option).isNotNull(); assertThat(option.isPresent()).isFalse(); }, MetadataAccess.SERVICE); deleted = metadata.commit(() -> { return this.provider.removeRole(SecurityRole.FEED, "feedEditor"); }, MetadataAccess.SERVICE); assertThat(deleted).isFalse(); }