Skip to content
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

Open
wants to merge 1 commit into
base: kmson92
Choose a base branch
from

Conversation

kmson92
Copy link

@kmson92 kmson92 commented Dec 14, 2023

안녕하세요, 리뷰어님😊
코드리뷰 부탁드리겠습니다.

강의를 들은 후에 리팩토링을 진행하였더니 강의에서 들은 내용으로 리팩토링을 하게 되네요😅
감사합니다.

Copy link

@kyucumber kyucumber left a 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)) {

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가 적절히 구현되어있는지도 한번 확인해보시면 좋을 것 같네요!

Comment on lines +20 to +26
public void delete(NsUser loginUser) throws CannotDeleteException {
for(Answer answer : answers) {
answer.delete(loginUser);
}
}

public List<DeleteHistory> deleteHistories() {

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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answers에 대한 단위 테스트도 작성해보면 어떨까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants