public void testReactivate() throws Throwable {
String username = "username_test";
String token = "token_test";
try {
// prepare
User user = new User();
user.setDisabled(true);
user.setUsername(username);
user.setPassword("password");
_userManager.addUser(user);
_userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.REACTIVATION_RECOVER_TOKEN_TYPE);
this.initAction("/do/jpuserreg/UserReg", "reactivate");
this.addParameter("token", token);
this.addParameter("password", "password");
this.addParameter("passwordConfirm", "wrongPasswordConfirm");
String result = this.executeAction();
assertEquals("input", result);
this.initAction("/do/jpuserreg/UserReg", "reactivate");
this.addParameter("token", token);
this.addParameter("password", "new_password");
this.addParameter("passwordConfirm", "new_password");
result = this.executeAction();
assertEquals("success", result);
user = (User) _userManager.getUser(username,"new_password");
assertNotNull(user);
assertFalse(user.isDisabled());
} finally {
// clean
_userManager.removeUser(username);
}
}