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);
}
댓글 ( 4)
댓글 남기기