KeyCloakGroupManager extends BaseKeyCloakManager implements GroupManager,
                                                                         ContextualManager { @Override public List<Group> getAll() throws SecurityManagementException { final List<Group> roles = new LinkedList<>(); consumeRealm(realmResource -> { final RolesResource rolesResource = realmResource.roles(); final List<RoleRepresentation> roleRepresentations = rolesResource.list(); if (roleRepresentations != null && !roleRepresentations.isEmpty()) { for (RoleRepresentation role : roleRepresentations) { final String name = role.getName(); final Group group = createGroup(name); roles.add(group); } } }); return roles; } KeyCloakGroupManager(); @Override void initialize(UserSystemManager userSystemManager); @Override SearchResponse<Group> search(SearchRequest request); @Override Group get(String identifier); @Override List<Group> getAll(); @Override Group create(Group entity); @Override Group update(Group entity); @Override void delete(String... identifiers); @Override GroupManagerSettings getSettings(); @Override void assignUsers(String name,
                            Collection<String> users); @Override void destroy();  }
@Test public void testGetAllGroups() { List<Group> groups = groupsManager.getAll(); assertEquals(50, groups.size()); }