I am new to Junit test cases can somebody please me with the below.
I need to write a junit test case for user password reset. I am not sure how can i use assert here:
public @ResponseBody userInfo updatePassword(@RequestBody Map<String, String> userLookup, HttpServletRequest request) {
userInfo userInfo = new userInfo();
try {
Users user = Service.getUserDetailsByUsername(userLookup.get("username"));
user.setPassword(userLookup.get("newPassword"));
Service.updateUserPw(user);
logger.debug("Password updated successfully");
} catch (Exception ex) {
logger.debug("Error while updating user password!", ex);
}
return userInfo;
}
method:getUserDetailsByUsername returns a user with the username passed.
method:setPassword returns return void
method: updateUserPw returns void