-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1단계 - 레거시 코드 리팩터링 #391
base: kmson92
Are you sure you want to change the base?
1단계 - 레거시 코드 리팩터링 #391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요
몇가지 코멘트 남겨두었으니 확인 부탁드립니다.
return answers; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Question [id=" + getId() + ", title=" + title + ", contents=" + contents + ", writer=" + writer + "]"; | ||
} | ||
|
||
public void delete(NsUser loginUser) throws CannotDeleteException { | ||
if (!isOwner(loginUser)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isOwner의 내부를 보면 아래와 같은 메서드를 호출하고 있습니다.
writer.equals(loginUser);
equals가 적절히 구현되어있는지도 한번 확인해보시면 좋을 것 같네요!
public void delete(NsUser loginUser) throws CannotDeleteException { | ||
for(Answer answer : answers) { | ||
answer.delete(loginUser); | ||
} | ||
} | ||
|
||
public List<DeleteHistory> deleteHistories() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answer.deleteHistory 내부에서 LocalDateTime.now()를 사용하고 있는 것 같아요.
delete 시점과 deleteHistories가 호출된 시점이 약간 차이가 있을 수 있지 않을까요?
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Answers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answers에 대한 단위 테스트도 작성해보면 어떨까요?
안녕하세요, 리뷰어님😊
코드리뷰 부탁드리겠습니다.
강의를 들은 후에 리팩토링을 진행하였더니 강의에서 들은 내용으로 리팩토링을 하게 되네요😅
감사합니다.