File tree Expand file tree Collapse file tree 4 files changed +7
-8
lines changed
main/java/com/somemore/community Expand file tree Collapse file tree 4 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -55,4 +55,8 @@ public void updateWith(CommunityCommentUpdateRequestDto dto) {
5555 public void replaceComment () {
5656 this .content = "삭제된 댓글입니다" ;
5757 }
58+
59+ public Boolean isDeleted () {
60+ return this .getDeleted ();
61+ }
5862}
Original file line number Diff line number Diff line change 33import com .somemore .community .domain .CommunityComment ;
44import lombok .Builder ;
55
6+ @ Builder
67public record CommunityCommentView (
78 CommunityComment communityComment ,
89 String writerNickname
910) {
10- @ Builder
11- public CommunityCommentView (CommunityComment communityComment , String writerNickname ) {
12- this .communityComment = communityComment ;
13- this .writerNickname = writerNickname ;
14- }
15-
1611 public CommunityCommentView replaceWriterNickname (CommunityCommentView communityCommentView ) {
1712 return CommunityCommentView .builder ()
1813 .communityComment (communityCommentView .communityComment )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ private List<Long> findParentCommentIds(List<CommunityCommentView> comments) {
4444 private Optional <CommunityCommentView > processDeletedComment (List <Long > parentCommentIds , CommunityCommentView commentView ) {
4545 CommunityComment comment = commentView .communityComment ();
4646
47- if (comment .getDeleted ()) {
47+ if (comment .isDeleted ()) {
4848 if (parentCommentIds .contains (comment .getId ())) {
4949 return Optional .of (commentView .replaceWriterNickname (commentView ));
5050 }
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ void getCommentsByCommunityBoardIdWithDeletedComment() {
131131 //then
132132 assertThat (comments ).hasSize (1 );
133133 assertThat (comments .getFirst ().content ()).isEqualTo ("삭제된 댓글입니다" );
134- assertThat (comments .getFirst ().writerNickname ()).isEqualTo ( "" );
134+ assertThat (comments .getFirst ().writerNickname ()).isEmpty ( );
135135 assertThat (comments .getFirst ().replies ()).hasSize (1 );
136136 assertThat (comments .getFirst ().replies ().getFirst ().id ()).isEqualTo (replyId );
137137 }
You can’t perform that action at this time.
0 commit comments