AuthenticationManagerLdapImpl extends AuthenticationManager { public void changePassword(final User user, final String password) { authenticationManagerLdapTemplate.changePassword(user, password); } AuthenticationManagerLdapImpl(ConfigurationUtil cfg, IUserRolesService userRolesService,
            AuthenticationManagerLdapTemplate authenticationManagerLdapTemplate); static AuthenticationManager getDefault(); boolean checkPassword(User user, String password); String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); String resetPasswordExternal(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); void changePassword(final User user, final String password);  }
@Test public void changeAsUserPassword() throws Exception { doNothing().when(authManagerLdapTemplate).modifyAttributes(any(DirContext.class), eq(user), any(ModificationItem[].class)); sut.changePassword(user, NEW_PASSWORD); verify(authManagerLdapTemplate).changePassword(user, NEW_PASSWORD); verify(authManagerLdapTemplate).getTemplate(user); verify(authManagerLdapTemplate).getCallback(user, NEW_PASSWORD); verify(authManagerLdapTemplate).changeLdapUserPassword(any(DirContext.class), eq(NEW_PASSWORD), eq(user)); }
@Test public void changeAsAdminPassword() throws Exception { User userAdmin = getUserAdmin(); doNothing().when(authManagerLdapTemplate).modifyAttributes(any(DirContext.class), eq(user), any(ModificationItem[].class)); sut.changePassword(user, NEW_PASSWORD, userAdmin); verify(authManagerLdapTemplate).changePassword(user, NEW_PASSWORD, userAdmin); verify(authManagerLdapTemplate).getTemplate(userAdmin); verify(authManagerLdapTemplate).getCallback(user, NEW_PASSWORD); verify(authManagerLdapTemplate).changeLdapUserPassword(any(DirContext.class), eq(NEW_PASSWORD), eq(user)); }