Skip to content

Commit

Permalink
[test] : V1, V2 통합에 따른 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Nov 23, 2024
1 parent 97f30ef commit 9463711
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9463711

Please sign in to comment.