Skip to content

Commit a75904e

Browse files
authored
Merge pull request #376 from prgrms-web-devcourse-final-project/develop
채택 기능 적용 범위 수정 (#375)
2 parents 89b40db + 09a869a commit a75904e

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

back/src/main/java/com/back/domain/post/comment/service/PostCommentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void adoptComment(Long commentId, Member member) {
8282
Post post = postComment.getPost();
8383

8484
validateIsPostAuthor(post, member);
85-
validatePostType(post);
85+
//validatePostType(post);
8686
validateAlreadyAdoptedComment(postComment);
8787
validateAlreadyExistsAdoptedComment(post);
8888

back/src/test/java/com/back/domain/post/comment/service/PostCommentServiceTest.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -335,23 +335,26 @@ void adoptComment_notPostAuthor_failure() {
335335
.hasMessage("400 : 채택 권한이 없습니다.");
336336
}
337337

338-
@Test
339-
@DisplayName("질문 게시글이 아닌 게시글의 댓글 채택 시도 시 실패")
340-
void adoptComment_notQuestionPost_failure() {
341-
// given
342-
Member postAuthor = MemberFixture.create(1L, "[email protected]", "Author", "password", Member.Role.MENTEE);
343-
Member commenter = MemberFixture.create(2L, "[email protected]", "Commenter", "password", Member.Role.MENTOR);
344-
Post informationPost = createDefaultPost(postAuthor);
345-
PostComment comment = createComment(commenter, informationPost, "일반 댓글");
346-
Long commentId = 1L;
347-
348-
when(postCommentRepository.findById(commentId)).thenReturn(Optional.of(comment));
349-
350-
// when & then
351-
assertThatThrownBy(() -> postCommentService.adoptComment(commentId, postAuthor))
352-
.isInstanceOf(ServiceException.class)
353-
.hasMessage("400 : 질문 게시글만 채택된 댓글을 가질 수 있습니다.");
354-
}
338+
// 운영 정책상
339+
// 변경 질문게시글 에서만 채택 가능 -> 전체 게시글에서 채택 가능
340+
//
341+
// @Test
342+
// @DisplayName("질문 게시글이 아닌 게시글의 댓글 채택 시도 시 실패")
343+
// void adoptComment_notQuestionPost_failure() {
344+
// // given
345+
// Member postAuthor = MemberFixture.create(1L, "[email protected]", "Author", "password", Member.Role.MENTEE);
346+
// Member commenter = MemberFixture.create(2L, "[email protected]", "Commenter", "password", Member.Role.MENTOR);
347+
// Post informationPost = createDefaultPost(postAuthor);
348+
// PostComment comment = createComment(commenter, informationPost, "일반 댓글");
349+
// Long commentId = 1L;
350+
//
351+
// when(postCommentRepository.findById(commentId)).thenReturn(Optional.of(comment));
352+
//
353+
// // when & then
354+
// assertThatThrownBy(() -> postCommentService.adoptComment(commentId, postAuthor))
355+
// .isInstanceOf(ServiceException.class)
356+
// .hasMessage("400 : 질문 게시글만 채택된 댓글을 가질 수 있습니다.");
357+
// }
355358

356359
@Test
357360
@DisplayName("이미 채택된 댓글을 다시 채택 시도 시 실패")

0 commit comments

Comments
 (0)