	@Test
	public void register() throws UserExistException{

		User user = new User();
		user.setUserName("tom");
		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);
		assertThat(user.getUserId(), equalTo(1));
		verify(userDao, times(1)).save(user);
	}