-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from HongDam-org/feat/member-api-docs
[FEAT] member api docs
- Loading branch information
Showing
4 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ include::auth.adoc[] | |
include::path.adoc[] | ||
include::plan.adoc[] | ||
include::place.adoc[] | ||
include::member.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
backend/src/test/java/com/twtw/backend/domain/member/controller/MemberControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.twtw.backend.domain.member.controller; | ||
|
||
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest; | ||
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse; | ||
|
||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
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.member.service.MemberService; | ||
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; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.web.servlet.ResultActions; | ||
|
||
@DisplayName("MemberController의") | ||
@WebMvcTest(MemberController.class) | ||
public class MemberControllerTest extends RestDocsTest { | ||
@MockBean private MemberService memberService; | ||
|
||
@Test | ||
@DisplayName("닉네임이 중복되었는가") | ||
void duplicate() throws Exception { | ||
final ResultActions perform = | ||
mockMvc.perform( | ||
get("/member/duplicate/{name}", "진주원") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.header( | ||
"Authorization", | ||
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh")); | ||
|
||
// then | ||
perform.andExpect(status().isOk()); | ||
// docs | ||
|
||
perform.andDo(print()) | ||
.andDo( | ||
document( | ||
"get duplicate nickname", | ||
getDocumentRequest(), | ||
getDocumentResponse())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters