Question: Write a happy-path test for the class presented below. Verify that the user gets his new password, and that the updateUser() method of userDAO is
Write a happy-path test for the class presented below. Verify that the user gets his new password, and that the updateUser() method of userDAO is called.
Listing 5.43. The UserServiceImpl class public class UserServiceImpl {
private UserDAO userDAO; private SecurityService securityService; public void assignPassword(User user) throws Exception { String passwordMd5 = securityService.md5(user.getPassword()); user.setPassword(passwordMd5); userDAO.updateUser(user); } public UserServiceImpl(UserDAO dao, SecurityService security) { this.userDAO = dao; this.securityService = security; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
