Skip to content

Commit

Permalink
Fix: update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
yerim216 committed Jun 1, 2024
1 parent ac28dea commit c4a0118
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

import cmc.cmc15th_hackathon.docs.RestDocsSupport;
import cmc.cmc15th_hackathon.domain.gpt.controller.GptController;
import cmc.cmc15th_hackathon.domain.gpt.request.GptRequest;
import cmc.cmc15th_hackathon.domain.gpt.request.GptRequest.RandomPayerRequest;
import cmc.cmc15th_hackathon.domain.gpt.response.GptResponse;
import cmc.cmc15th_hackathon.domain.gpt.response.GptResponse.GptPayerResponse;
import cmc.cmc15th_hackathon.domain.gpt.service.GptService;
import com.epages.restdocs.apispec.ResourceSnippetParameters;
import java.util.List;
Expand Down Expand Up @@ -52,6 +50,8 @@ void gptRandomPayer() throws Exception {
.description("상태코드"),
fieldWithPath("message").type(JsonFieldType.STRING)
.description("응답 메시지"),
fieldWithPath("data.title").type(JsonFieldType.STRING)
.description("제목"),
fieldWithPath("data.content").type(JsonFieldType.STRING)
.description("출력값")
)
Expand All @@ -60,7 +60,10 @@ void gptRandomPayer() throws Exception {
"get-random-payer-api", prettyPrint(), prettyPrint(), parameters);

BDDMockito.given(gptService.getRandomPayer(any(RandomPayerRequest.class)))
.willReturn(GptPayerResponse.response("덕배가 계산합니다. 오늘 지갑이 가벼워질 운세입니다."));
.willReturn(GptResponse.GptPayerResponse.builder()
.title("축하합니다 미리님!")
.content("오늘 계산할 사람은 미리입니다. 왜냐면 지갑이 텅텅?")
.build());
//when //then
mockMvc.perform(
RestDocumentationRequestBuilders.post("/gpt/random-payer")
Expand Down

0 comments on commit c4a0118

Please sign in to comment.