  public void testUpdateUser() throws Exception {
    Set<JpaRole> authorities = new HashSet<JpaRole>();
    authorities.add(new JpaRole("ROLE_ASTRO_101_SPRING_2011_STUDENT", org1));

    JpaUser user = new JpaUser("user1", "pass1", org1, provider.getName(), true, authorities);
    provider.addUser(user);

    User loadUser = provider.loadUser("user1");

    assertNotNull(loadUser);

    authorities.add(new JpaRole("ROLE_ASTRO_101_SPRING_2013_STUDENT", org1));
    String newPassword = "newPassword";
    JpaUser updateUser = new JpaUser(user.getUsername(), newPassword, org1, provider.getName(), true, authorities);

    User loadUpdatedUser = provider.updateUser(updateUser);
    // User loadUpdatedUser = provider.loadUser(user.getUsername());

    assertNotNull(loadUpdatedUser);
    assertEquals(user.getUsername(), loadUpdatedUser.getUsername());
    assertEquals(PasswordEncoder.encode(newPassword, user.getUsername()), loadUpdatedUser.getPassword());
    assertEquals(authorities.size(), loadUpdatedUser.getRoles().size());

    updateUser = new JpaUser("unknown", newPassword, org1, provider.getName(), true, authorities);

    try {
      provider.updateUser(updateUser);
      fail("Should throw a NotFoundException");
    } catch (NotFoundException e) {
      assertTrue("User not found.", true);
    }

  }
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.