Skip to content

Commit

Permalink
[TEST] api test 및 adoc 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Sep 24, 2023
1 parent 0486614 commit 01cc7ce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion backend/src/docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
= TWTW API
HongDamJin

include::plan.adoc[]
include::auth.adoc[]
include::path.adoc[]
include::plan.adoc[]
include::place.adoc[]
7 changes: 5 additions & 2 deletions backend/src/docs/path.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
:toclevels: 4

== Path
=== 경로 검색
operation::post search path[snippets='http-request,http-response']
=== 차 경로 검색
operation::post search car path[snippets='http-request,http-response']

=== 보행자 경로 검색
operation::post search ped path[snippets='http-request,http-response']
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
package com.twtw.backend.domain.path.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.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.twtw.backend.domain.path.dto.client.car.*;
import com.twtw.backend.domain.path.dto.client.ped.SearchPedPathResponse;
import com.twtw.backend.domain.path.service.PathService;
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 @@ -26,6 +14,15 @@
import java.util.List;
import java.util.Map;

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.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@DisplayName("PathController의")
@WebMvcTest(PathController.class)
class PathControllerTest extends RestDocsTest {
Expand Down Expand Up @@ -72,7 +69,7 @@ void searchCarPath() throws Exception {

// docs
perform.andDo(print())
.andDo(document("post search path", getDocumentRequest(), getDocumentResponse()));
.andDo(document("post search car path", getDocumentRequest(), getDocumentResponse()));
}

@Test
Expand Down Expand Up @@ -105,6 +102,6 @@ void searchPedPath() throws Exception {

// docs
perform.andDo(print())
.andDo(document("post search path", getDocumentRequest(), getDocumentResponse()));
.andDo(document("post search ped path", getDocumentRequest(), getDocumentResponse()));
}
}

0 comments on commit 01cc7ce

Please sign in to comment.