From 97f30effa1f8df1219dbaee92539798709442107 Mon Sep 17 00:00:00 2001 From: dudxo Date: Sat, 23 Nov 2024 16:43:26 +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=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AnswerControllerTest.java | 24 ------------------- .../answer/service/AnswerServiceTest.java | 21 ---------------- 2 files changed, 45 deletions(-) diff --git a/src/test/java/com/dnd/gongmuin/answer/controller/AnswerControllerTest.java b/src/test/java/com/dnd/gongmuin/answer/controller/AnswerControllerTest.java index 0eb74ef2..9cccbc84 100644 --- a/src/test/java/com/dnd/gongmuin/answer/controller/AnswerControllerTest.java +++ b/src/test/java/com/dnd/gongmuin/answer/controller/AnswerControllerTest.java @@ -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"); - } } \ No newline at end of file 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 fedc50b5..23e8f52e 100644 --- a/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java +++ b/src/test/java/com/dnd/gongmuin/answer/service/AnswerServiceTest.java @@ -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() {