Skip to content

Conversation

@FA-50
Copy link

@FA-50 FA-50 commented Nov 13, 2025

저도 도메인 팩토리 메서드 및 업데이트 메서드에 validation을 작성했습니다.

Errocode 임의로 REPLY_CONTENT_REQUIRED 생성해서 추가했습니다

@FA-50 FA-50 self-assigned this Nov 13, 2025
private PostEntity parentPost;

public void update(String content) {
if ( Strings.isBlank(content) ) throw new CustomException(ErrorCode.REPLY_CONTENT_EMPTY);
Copy link
Contributor

Choose a reason for hiding this comment

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

StringUtils.hasText() 로 비교하는건 어떨까요 혹은 null 체크도 먼저 같이 하심이 좋을듯 합니다

Copy link
Author

Choose a reason for hiding this comment

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

StringUtils.hasText() 로 비교하는건 어떨까요 혹은 null 체크도 먼저 같이 하심이 좋을듯 합니다

제 기억상으로 아마 org.apache.logging.log4j.util.Strings; Strings.isBlank() 랑 Strings.isNotBlank()가 null체크도 같이 포함되어있는걸로 알고있습니다!

Choose a reason for hiding this comment

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

저도 이부분 Strings.isBlank로 체크하는데, null 까지 같이 체크해줍니다

Comment on lines 23 to 24
postEntity = new PostEntity();
userEntity = new UserEntity();
Copy link
Contributor

Choose a reason for hiding this comment

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

빈값으로 생성을 함부로 하지 말라는 정책대로라고 한다면 여기서 new entity() 빈값으로 처리하시지 마시고
필드값 다 넣어서 만들어 버리세요!!

post랑 user 를 빈값으로 둬서 빈 게시판인지 없는 유저인지 등을 체크하시려고 하신것같은데, 그건 음 이미 상위 개념이니 PostTest, UserTest 에서 테스트를 마쳤다고 생각하시면 편할듯 합니다

Copy link
Author

Choose a reason for hiding this comment

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

빈값으로 생성을 함부로 하지 말라는 정책대로라고 한다면 여기서 new entity() 빈값으로 처리하시지 마시고 필드값 다 넣어서 만들어 버리세요!!

post랑 user 를 빈값으로 둬서 빈 게시판인지 없는 유저인지 등을 체크하시려고 하신것같은데, 그건 음 이미 상위 개념이니 PostTest, UserTest 에서 테스트를 마쳤다고 생각하시면 편할듯 합니다

넵 초기값 지정해서 처리하겠습니당

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.

4 participants