From 946371178ef731846031059b253d6509825a7a72 Mon Sep 17 00:00:00 2001 From: dudxo Date: Sat, 23 Nov 2024 17:26:43 +0900 Subject: [PATCH] =?UTF-8?q?[test]=20:=20V1,=20V2=20=ED=86=B5=ED=95=A9?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../answer/service/AnswerServiceTest.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java b/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java index 23e8f52e..bdc90b21 100644 --- a/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java +++ b/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java @@ -130,9 +130,9 @@ void chooseAnswer() { QuestionPost questionPost = QuestionPostFixture.questionPost(questionPostId, member); Answer answer = AnswerFixture.answer(1L, questionPostId); - given(answerRepository.findById(answer.getId())) + given(answerSimpleQueryRepository.findAnswerById(answer.getId())) .willReturn(Optional.of(answer)); - given(questionPostRepository.findById(questionPost.getId())) + given(questionPostSimpleQueryRepository.findQuestionPostById(questionPost.getId())) .willReturn(Optional.of(questionPost)); //when @@ -152,9 +152,9 @@ void chooseAnswer_fail() { ReflectionTestUtils.setField(questionPost, "reward", member.getCredit() + 1); Answer answer = AnswerFixture.answer(1L, questionPostId); - given(answerRepository.findById(answer.getId())) + given(answerSimpleQueryRepository.findAnswerById(answer.getId())) .willReturn(Optional.of(answer)); - given(questionPostRepository.findById(questionPost.getId())) + given(questionPostSimpleQueryRepository.findQuestionPostById(questionPost.getId())) .willReturn(Optional.of(questionPost)); //when & then @@ -174,9 +174,9 @@ void chooseAnswer_fail2() { QuestionPost questionPost = QuestionPostFixture.questionPost(questionPostId, questioner); Answer answer = AnswerFixture.answer(1L, questionPostId); - given(answerRepository.findById(answer.getId())) + given(answerSimpleQueryRepository.findAnswerById(answer.getId())) .willReturn(Optional.of(answer)); - given(questionPostRepository.findById(questionPost.getId())) + given(questionPostSimpleQueryRepository.findQuestionPostById(questionPost.getId())) .willReturn(Optional.of(questionPost)); //when & then @@ -210,8 +210,9 @@ void creditHistoryWithOneHundred() throws Exception { questionPosts.add(questionPost); answers.add(answer1); - given(answerRepository.findById(i)).willReturn(Optional.of(answer1)); - given(questionPostRepository.findById(questionPost.getId())).willReturn(Optional.of(questionPost)); + given(answerSimpleQueryRepository.findAnswerById(i)).willReturn(Optional.of(answer1)); + given(questionPostSimpleQueryRepository.findQuestionPostById(questionPost.getId())) + .willReturn(Optional.of(questionPost)); } // when