test_class.declarator: userDao
test_class.modifier: private
test_class.original_string: private UserDao userDao;
test_class.type: UserDao
test_class.var_name: userDao
test_class.declarator: userService
test_class.modifier: private
test_class.original_string: private UserService userService;
test_class.type: UserService
test_class.var_name: userService
test_class.file: chapter18/src/test/java/com/smart/service/UserServiceTest.java
test_class.identifier: UserServiceTest
test_class.superclass: extends BaseServiceTest
test_case.body: @Test
  	public void register() throws UserExistException{
  		User user = new User();
  		user.setUserName("testwww");
  		user.setPassword("1234");
  		
  		doAnswer(new Answer<User>() {
  			public User answer(InvocationOnMock invocation) {
  				Object[] args = invocation.getArguments();
  				User user = (User) args[0];
  				if (user != null) {
  					user.setUserId(1);
  				}
  				return user;
  			}
  		}).when(userDao).save(user);
  			
  		userService.register(user);
  		assertEquals(user.getUserId(), 1);
  		verify(userDao, times(1)).save(user);
  	}
test_case.class_method_signature: UserServiceTest.register()
test_case.full_signature: @Test public void register()
test_case.identifier: register
test_case.invocations: setUserName setPassword save when doAnswer getArguments setUserId register assertEquals getUserId save verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void register()
focal_class.declarator: userDao
focal_class.modifier: private
focal_class.original_string: private UserDao userDao;
focal_class.type: UserDao
focal_class.var_name: userDao
focal_class.declarator: loginLogDao
focal_class.modifier: private
focal_class.original_string: private LoginLogDao loginLogDao;
focal_class.type: LoginLogDao
focal_class.var_name: loginLogDao
focal_class.file: chapter18/src/main/java/com/smart/service/UserService.java
focal_class.identifier: UserService
focal_class.class_method_signature: UserService.setUserDao(UserDao userDao)
focal_class.full_signature: @Autowired public void setUserDao(UserDao userDao)
focal_class.identifier: setUserDao
focal_class.modifiers: @Autowired public
focal_class.parameters: (UserDao userDao)
focal_class.return: void
focal_class.signature: void setUserDao(UserDao userDao)
focal_class.class_method_signature: UserService.setLoginLogDao(LoginLogDao loginLogDao)
focal_class.full_signature: @Autowired public void setLoginLogDao(LoginLogDao loginLogDao)
focal_class.identifier: setLoginLogDao
focal_class.modifiers: @Autowired public
focal_class.parameters: (LoginLogDao loginLogDao)
focal_class.return: void
focal_class.signature: void setLoginLogDao(LoginLogDao loginLogDao)
focal_class.class_method_signature: UserService.register(User user)
focal_class.full_signature: public void register(User user)
focal_class.identifier: register
focal_class.modifiers: public
focal_class.parameters: (User user)
focal_class.return: void
focal_class.signature: void register(User user)
focal_class.class_method_signature: UserService.update(User user)
focal_class.full_signature: public void update(User user)
focal_class.identifier: update
focal_class.modifiers: public
focal_class.parameters: (User user)
focal_class.return: void
focal_class.signature: void update(User user)
focal_class.class_method_signature: UserService.getUserByUserName(String userName)
focal_class.full_signature: public User getUserByUserName(String userName)
focal_class.identifier: getUserByUserName
focal_class.modifiers: public
focal_class.parameters: (String userName)
focal_class.return: User
focal_class.signature: User getUserByUserName(String userName)
focal_class.class_method_signature: UserService.getUserById(int userId)
focal_class.full_signature: public User getUserById(int userId)
focal_class.identifier: getUserById
focal_class.modifiers: public
focal_class.parameters: (int userId)
focal_class.return: User
focal_class.signature: User getUserById(int userId)
focal_class.class_method_signature: UserService.lockUser(String userName)
focal_class.full_signature: public void lockUser(String userName)
focal_class.identifier: lockUser
focal_class.modifiers: public
focal_class.parameters: (String userName)
focal_class.return: void
focal_class.signature: void lockUser(String userName)
focal_class.class_method_signature: UserService.unlockUser(String userName)
focal_class.full_signature: public void unlockUser(String userName)
focal_class.identifier: unlockUser
focal_class.modifiers: public
focal_class.parameters: (String userName)
focal_class.return: void
focal_class.signature: void unlockUser(String userName)
focal_class.class_method_signature: UserService.queryUserByUserName(String userName)
focal_class.full_signature: public List<User> queryUserByUserName(String userName)
focal_class.identifier: queryUserByUserName
focal_class.modifiers: public
focal_class.parameters: (String userName)
focal_class.return: List<User>
focal_class.signature: List<User> queryUserByUserName(String userName)
focal_class.class_method_signature: UserService.getAllUsers()
focal_class.full_signature: public List<User> getAllUsers()
focal_class.identifier: getAllUsers
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<User>
focal_class.signature: List<User> getAllUsers()
focal_class.class_method_signature: UserService.loginSuccess(User user)
focal_class.full_signature: public void loginSuccess(User user)
focal_class.identifier: loginSuccess
focal_class.modifiers: public
focal_class.parameters: (User user)
focal_class.return: void
focal_class.signature: void loginSuccess(User user)
focal_method.body: public void register(User user) throws UserExistException{
  		User u = this.getUserByUserName(user.getUserName());
  		if(u != null){
  		    throw new UserExistException("用户名已经存在");
  		}else{
  		    user.setCredit(100);
              user.setUserType(1);
              userDao.save(user);
  		}
  	}
focal_method.class_method_signature: UserService.register(User user)
focal_method.full_signature: public void register(User user)
focal_method.identifier: register
focal_method.invocations: getUserByUserName getUserName setCredit setUserType save
focal_method.modifiers: public
focal_method.parameters: (User user)
focal_method.return: void
focal_method.signature: void register(User user)