스프링

 class UserTest 

	
	@Test(expected=IllegalArgumentException.class)
	public void updateWhenMisMatchUserId() throws Exception{
		User user =new User("userId", "password", "name", "javagigi@slipp.net");
		User updateUser=new User("userId", "password", "sangigi", "sangigi@slipp.net");
		User updatedUser =user.update(updateUser);
		assertThat(updatedUser, is(updatedUser));
	}
	
	

 

 class User 

	
	public User update(User updateUser)   {
		if(matchUserId(updateUser.userId)){
			throw new IllegalArgumentException();
		}
		return new User(this.userId,  updateUser.password, updateUser.name, updateUser.email);
	}	
    

 

 

 

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  머나먼나라

가정에서 행복해지는 것은 온갖 염원의 궁극적인 결과이다. - S. 존슨

댓글 ( 4)

댓글 남기기

작성