throws Exception
{
SecurityService ss = TurbineSecurity.getService();
UserManager um = ss.getUserManager();
User admin = um.retrieve("admin");
assertNotNull(admin);
um.changePassword(admin, admin.getPassword(), "foobar");
User admin2 = um.retrieve("admin");
assertEquals("Password was not changed!", "foobar", admin2.getPassword());
try
{
admin = um.retrieve("admin");
um.changePassword(admin, "admin", "foobar");
fail("Password could be changed without old password!");
}
catch (Exception e)
{
assertEquals("Wrong Exception thrown: " + e.getClass().getName(), e.getClass(), PasswordMismatchException.class);
}
admin2 = um.retrieve("admin");
assertEquals("Password was changed!", "foobar", admin2.getPassword());
checkUserList();
}