inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

유지상님의 게시글

유지상 유지상

@jidbyoo0497

수강평 작성수
1
평균평점
5.0

게시글 2

질문&답변

CommentServiceTest에서 테스트 오류가 나요.

CommentService 파일과 CommentServiceTest 파일 모두 복붙해서 진행해도 해결이 안되어서, 두개의 파일 모두 삭제하고 다시 복붙해서 넣으니까 해결되었습니다! 감사합니다!

좋아요수
0
댓글수
4
조회수
285

질문&답변

CommentServiceTest에서 테스트 오류가 나요.

strictness 설정으로 해결하였습니다. 그러나 강사님과 같은 개발환경으로 버전까지 똑같이해서 작성하는데 왜 차이가 나는지 알고싶어요. 추가로, 3번째 테스트 에도 오류가 납니다. @Test @DisplayName("하위 댓글이 삭제되고, 삭제된 부모면, 재귀적으로 모두 삭제한다.") void deleteShouldDeleteAllRecursivelyIfDeleteParent() { // given Long articleId = 1L; Long commentId = 2L; Long parentCommentId = 1L; Comment comment = createComment(articleId, commentId, parentCommentId); given(comment.isRoot()).willReturn(false); Comment parentComment = createComment(articleId, parentCommentId); given(parentComment.isRoot()).willReturn(true); given(parentComment.getDeleted()).willReturn(true); given(commentRepository.findById(commentId)) .willReturn(Optional.of(comment)); given(commentRepository.countBy(articleId, commentId, 2L)).willReturn(1L); given(commentRepository.findById(parentCommentId)) .willReturn(Optional.of(parentComment)); given(commentRepository.countBy(articleId, parentCommentId, 2L)).willReturn(1L); // when commentService.delete(commentId); // then verify(commentRepository).delete(comment); verify(commentRepository).delete(parentComment); }

좋아요수
0
댓글수
4
조회수
285