Skip to content

Commit

Permalink
[DOCS] rest docs 누락된 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Dec 18, 2023
1 parent 8bcacb3 commit 83191db
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
1 change: 1 addition & 0 deletions backend/src/docs/member.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
== Member
=== 닉네임 중복 검색
operation::get duplicate nickname[snippets='http-request,http-response']

=== 닉네임으로 멤버 검색
operation::get member nickname[snippets='http-request,http-response']
2 changes: 1 addition & 1 deletion backend/src/docs/plan.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ operation::post out plan[snippets='http-request,http-response']
=== 본인이 속한 계획 전체 조회
operation::get all plans[snippets='http-request,http-response']

=== 본인이 속한 계획 전체 조회
=== 계획 수정
operation::post update plan[snippets='http-request,http-response']
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
package com.twtw.backend.domain.plan.controller;

import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest;
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willDoNothing;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.twtw.backend.domain.group.dto.response.GroupInfoResponse;
import com.twtw.backend.domain.member.dto.response.MemberResponse;
import com.twtw.backend.domain.place.entity.CategoryGroupCode;
Expand All @@ -26,7 +12,6 @@
import com.twtw.backend.domain.plan.dto.response.PlanResponse;
import com.twtw.backend.domain.plan.service.PlanService;
import com.twtw.backend.support.docs.RestDocsTest;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
Expand All @@ -37,6 +22,17 @@
import java.util.List;
import java.util.UUID;

import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest;
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willDoNothing;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@DisplayName("PlanController의")
@WebMvcTest(PlanController.class)
class PlanControllerTest extends RestDocsTest {
Expand Down Expand Up @@ -168,6 +164,9 @@ void getPlanById() throws Exception {
@Test
@DisplayName("단건 삭제 API가 수행되는가")
void deletePlanById() throws Exception {
// given
willDoNothing().given(planService).deletePlan(any());

// when
final ResultActions perform =
mockMvc.perform(
Expand Down Expand Up @@ -222,6 +221,9 @@ void joinPlan() throws Exception {
@Test
@DisplayName("계획 탈퇴 API가 수행되는가")
void outPlan() throws Exception {
// given
willDoNothing().given(planService).outPlan(any());

// when
final ResultActions perform =
mockMvc.perform(
Expand All @@ -242,6 +244,36 @@ void outPlan() throws Exception {
@Test
@DisplayName("계획 전체 조회 API가 수행되는가")
void getPlans() throws Exception {
// given
final List<PlanInfoResponse> expected = List.of(new PlanInfoResponse(
UUID.randomUUID(),
UUID.randomUUID(),
UUID.randomUUID(),
new PlaceDetails(
"카페 온마이마인드",
"https://place.map.kakao.com/1625295668",
"경기 안성시 죽산면 죽산초교길 36-4",
127.420430538256,
37.0766874564297),
new GroupInfoResponse(
UUID.randomUUID(), UUID.randomUUID(), "홍담진", "http://someUrlToS3"),
List.of(new MemberResponse(UUID.randomUUID(), "진호정"))),
new PlanInfoResponse(
UUID.randomUUID(),
UUID.randomUUID(),
UUID.randomUUID(),
new PlaceDetails(
"카페 온유어마인드",
"https://place.map.kakao.com/1625295669",
"경기 안성시 죽산면 죽산초교길 36-5",
127.420430538257,
37.0766874564298),
new GroupInfoResponse(
UUID.randomUUID(), UUID.randomUUID(), "HongDamJin", "http://someUrlToS3"),
List.of(new MemberResponse(UUID.randomUUID(), "JinHoJeong"))));

given(planService.getPlans()).willReturn(expected);

// when
final ResultActions perform =
mockMvc.perform(
Expand Down

0 comments on commit 83191db

Please sign in to comment.