@Test
public void shouldApplyUpdate() throws NamingException {

    assertThat(user.isPasswordExpired(), is(Boolean.TRUE));
    assertThat(user.getLdapPassword(), is(PASSWORD));
    Attribute newPasswordAttribute = new BasicAttribute("userPassword", NEW_PASSWORD);
    ModificationItem[] mods = new ModificationItem[1];
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, newPasswordAttribute);
    try {
        dirContext.modifyAttributes(user.getLdapName(), mods);
    } catch (NamingException e) {
        AuthenticationManagerLdapImpl.log.error(e);
        throw e;
    }
    user.setPasswordExpired(Boolean.FALSE);
    user.setLdapPassword(NEW_PASSWORD);
    assertThat(user.isPasswordExpired(), is(Boolean.FALSE));
    assertThat(user.getLdapPassword(), is(NEW_PASSWORD));
}