@Test public void unlockUser() { User user = new User(); user.setUserName("tom"); user.setPassword("1234"); user.setLocked(User.USER_LOCK); doReturn(user).when(userDao).getUserByUserName("tom"); doNothing().when(userDao).update(user); userService.unlockUser("tom"); User u = userService.getUserByUserName("tom"); assertEquals(User.USER_UNLOCK, u.getLocked()); }
public void unlockUser(String userName){ User user = userDao.getUserByUserName(userName); user.setLocked(User.USER_UNLOCK); userDao.update(user); }
UserService { public void unlockUser(String userName){ User user = userDao.getUserByUserName(userName); user.setLocked(User.USER_UNLOCK); userDao.update(user); } }
UserService { public void unlockUser(String userName){ User user = userDao.getUserByUserName(userName); user.setLocked(User.USER_UNLOCK); userDao.update(user); }  }
UserService { public void unlockUser(String userName){ User user = userDao.getUserByUserName(userName); user.setLocked(User.USER_UNLOCK); userDao.update(user); }  void register(User user); void update(User user); User getUserByUserName(String userName); User getUserById(int userId); void lockUser(String userName); void unlockUser(String userName); List<User> queryUserByUserName(String userName); List<User> getAllUsers(); void loginSuccess(User user); }
UserService { public void unlockUser(String userName){ User user = userDao.getUserByUserName(userName); user.setLocked(User.USER_UNLOCK); userDao.update(user); }  void register(User user); void update(User user); User getUserByUserName(String userName); User getUserById(int userId); void lockUser(String userName); void unlockUser(String userName); List<User> queryUserByUserName(String userName); List<User> getAllUsers(); void loginSuccess(User user);  }