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 ca844e8 commit 97f30ef
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,4 @@ void chooseAnswer() throws Exception {
long endTime = System.currentTimeMillis();
System.out.println("Execution time: " + (endTime - startTime) + " ms");
}

@DisplayName("[질문자는 답변을 채택할 수 있다.V2]")
@Test
void chooseAnswerV2() throws Exception {
QuestionPost questionPost
= questionPostRepository.save(QuestionPostFixture.questionPost(loginMember));
Member answerer = memberRepository.save(MemberFixture.member2());
Answer answer = answerRepository.save(AnswerFixture.answer(questionPost.getId(), answerer));
long startTime = System.currentTimeMillis();

mockMvc.perform(post("/api/v2/question-posts/answers/{answerId}", answer.getId())
.cookie(accessToken)
)
.andExpect(status().isOk())
.andExpect(jsonPath("$.content").value(answer.getContent()))
.andExpect(jsonPath("$.isChosen").value(true))
.andExpect(jsonPath("$.isQuestioner").value(false))
.andExpect(jsonPath("$.memberInfo.memberId").value(answerer.getId()))
.andExpect(jsonPath("$.memberInfo.nickname").value(answerer.getNickname()))
.andExpect(jsonPath("$.memberInfo.memberJobGroup").value(answerer.getJobGroup().getLabel())
);
long endTime = System.currentTimeMillis();
System.out.println("Execution time: " + (endTime - startTime) + " ms");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,6 @@ void chooseAnswer() {
Assertions.assertThat(response.isChosen()).isTrue();
}

@DisplayName("[답변을 채택할 수 있다.]")
@Test
void chooseAnswerV2() {
//given
Long questionPostId = 1L;
Member member = MemberFixture.member(1L);
QuestionPost questionPost = QuestionPostFixture.questionPost(questionPostId, member);
Answer answer = AnswerFixture.answer(1L, questionPostId);

given(answerSimpleQueryRepository.findAnswerById(answer.getId()))
.willReturn(Optional.of(answer));
given(questionPostSimpleQueryRepository.findQuestionPostById(questionPost.getId()))
.willReturn(Optional.of(questionPost));

//when
AnswerDetailResponse response = answerService.chooseAnswerV2(answer.getId(), member);

//then
Assertions.assertThat(response.isChosen()).isTrue();
}

@DisplayName("[크레딧이 부족하면 답변을 채택할 수 없다.]")
@Test
void chooseAnswer_fail() {
Expand Down

0 comments on commit 97f30ef

Please sign in to comment.