KeyCloakUserManager extends BaseKeyCloakManager implements UserManager,
                                                                        ContextualManager { @Override public void changePassword(String username, String newPassword) throws SecurityManagementException { checkNotNull("username", username); consumeRealm(realmResource -> { final UsersResource usersResource = realmResource.users(); final UserResource userResource = getUserResource(usersResource, username); if (userResource == null) { throw new UserNotFoundException(username); } final CredentialRepresentation credentialRepresentation = new CredentialRepresentation(); credentialRepresentation.setType(CREDENTIAL_TYPE_PASSWORD); credentialRepresentation.setValue(newPassword); userResource.resetPassword(credentialRepresentation); }); } 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 testChangePassword() { UserResource user0Resource = userResources.get(0); usersManager.changePassword("user0", "newPassword"); verify(user0Resource, times(1)).resetPassword(any(CredentialRepresentation.class)); }