KeyCloakUserManager extends BaseKeyCloakManager implements UserManager,
                                                                        ContextualManager { @Override public User create(User entity) throws SecurityManagementException { checkNotNull("entity", entity); consumeRealm(realmResource -> { final UsersResource usersResource = realmResource.users(); final UserRepresentation userRepresentation = new UserRepresentation(); fillUserRepresentationAttributes(entity, userRepresentation); final ClientResponse response = (ClientResponse) usersResource.create(userRepresentation); handleResponse(response); }); return entity; } KeyCloakUserManager(); @Override void initialize(final UserSystemManager userSystemManager); @Override SearchResponse<User> search(SearchRequest request); @Override User get(String username); @Override List<User> getAll(); @Override User create(User entity); @Override User update(User entity); @Override void delete(String... identifiers); @Override UserManagerSettings getSettings(); @Override void assignGroups(String username,
                             Collection<String> groups); @Override void assignRoles(String username,
                            Collection<String> roles); @Override void changePassword(String username,
                               String newPassword); @Override void destroy();  }
@Test public void testCreateUser() { User user = mock(User.class); when(user.getIdentifier()).thenReturn("user0"); User userCreated = usersManager.create(user); assertNotNull(userCreated); verify(usersResource, times(1)).create(any(UserRepresentation.class)); }