@@ -53,41 +53,41 @@ void signInTest() throws Exception {
53
53
/* Given */
54
54
AuthTokensResponse response = new AuthTokensResponse (0 , "at" , "rt" );
55
55
given (authService .generateToken (any (String .class ), any (String .class )))
56
- .willReturn (response );
56
+ .willReturn (response );
57
57
58
58
/* When */
59
59
ResultActions actions = mockMvc .perform (
60
- RestDocumentationRequestBuilders .post (
61
- "/auth/v1/sign-in/{provider}?code={code}" ,
62
- "google" ,
63
- "dummy_code"
64
- )
65
- .contentType (MediaType .APPLICATION_JSON )
60
+ RestDocumentationRequestBuilders .post (
61
+ "/auth/v1/sign-in/{provider}?code={code}" ,
62
+ "google" ,
63
+ "dummy_code"
64
+ )
65
+ .contentType (MediaType .APPLICATION_JSON )
66
66
);
67
67
68
68
/* Then */
69
69
actions .andDo (print ())
70
- .andDo (document ("auth/sign-in" ,
71
- preprocessRequest (prettyPrint ()),
72
- preprocessResponse (prettyPrint ()),
73
- pathParameters (
74
- parameterWithName ("provider" ).description ("소셜 로그인 제공자" )
75
- ),
76
- queryParameters (
77
- parameterWithName ("code" ).description ("인증 코드" )
78
- ),
79
- responseFields (
80
- fieldWithPath ("message" ).type (JsonFieldType .STRING )
81
- .description ("응답 메시지" ),
82
- fieldWithPath ("body.member_id" ).type (JsonFieldType .NUMBER )
83
- .description ("회원 식별자" ),
84
- fieldWithPath ("body.access_token" ).type (JsonFieldType .STRING )
85
- .description ("OAuth Access Token" ),
86
- fieldWithPath ("body.refresh_token" ).type (JsonFieldType .STRING )
87
- .description ("OAuth Refresh Token" )
88
- )
89
- ))
90
- .andExpect (status ().isOk ());
70
+ .andDo (document ("auth/sign-in" ,
71
+ preprocessRequest (prettyPrint ()),
72
+ preprocessResponse (prettyPrint ()),
73
+ pathParameters (
74
+ parameterWithName ("provider" ).description ("소셜 로그인 제공자" )
75
+ ),
76
+ queryParameters (
77
+ parameterWithName ("code" ).description ("인증 코드" )
78
+ ),
79
+ responseFields (
80
+ fieldWithPath ("message" ).type (JsonFieldType .STRING )
81
+ .description ("응답 메시지" ),
82
+ fieldWithPath ("body.member_id" ).type (JsonFieldType .NUMBER )
83
+ .description ("회원 식별자" ),
84
+ fieldWithPath ("body.access_token" ).type (JsonFieldType .STRING )
85
+ .description ("OAuth Access Token" ),
86
+ fieldWithPath ("body.refresh_token" ).type (JsonFieldType .STRING )
87
+ .description ("OAuth Refresh Token" )
88
+ )
89
+ ))
90
+ .andExpect (status ().isOk ());
91
91
}
92
92
93
93
@ DisplayName ("토큰을 재발급 한다." )
@@ -96,39 +96,39 @@ void reissueTest() throws Exception {
96
96
/* Given */
97
97
AuthTokensResponse response = new AuthTokensResponse (0 , "at" , "rt" );
98
98
given (authService .reissueToken (any (String .class ), any (String .class )))
99
- .willReturn (response );
99
+ .willReturn (response );
100
100
101
101
/* When */
102
102
ResultActions actions = mockMvc .perform (
103
- RestDocumentationRequestBuilders .put (
104
- "/auth/v1/reissue?access_token={access_token}&refresh_token={refresh_token}" ,
105
- "access" ,
106
- "refresh"
107
- )
108
- .contentType (MediaType .APPLICATION_JSON )
103
+ RestDocumentationRequestBuilders .put (
104
+ "/auth/v1/reissue?access_token={access_token}&refresh_token={refresh_token}" ,
105
+ "access" ,
106
+ "refresh"
107
+ )
108
+ .contentType (MediaType .APPLICATION_JSON )
109
109
);
110
110
111
111
/* Then */
112
112
actions .andDo (print ())
113
- .andDo (document ("auth/reissue" ,
114
- preprocessRequest (prettyPrint ()),
115
- preprocessResponse (prettyPrint ()),
116
- queryParameters (
117
- parameterWithName ("access_token" ).description ("Access Token" ),
118
- parameterWithName ("refresh_token" ).description ("Refresh Token" )
119
- ),
120
- responseFields (
121
- fieldWithPath ("message" ).type (JsonFieldType .STRING )
122
- .description ("응답 메시지" ),
123
- fieldWithPath ("body.member_id" ).type (JsonFieldType .NUMBER )
124
- .description ("회원 식별자" ),
125
- fieldWithPath ("body.access_token" ).type (JsonFieldType .STRING )
126
- .description ("OAuth Access Token" ),
127
- fieldWithPath ("body.refresh_token" ).type (JsonFieldType .STRING )
128
- .description ("OAuth Refresh Token" )
129
- )
130
- ))
131
- .andExpect (status ().isCreated ());
113
+ .andDo (document ("auth/reissue" ,
114
+ preprocessRequest (prettyPrint ()),
115
+ preprocessResponse (prettyPrint ()),
116
+ queryParameters (
117
+ parameterWithName ("access_token" ).description ("Access Token" ),
118
+ parameterWithName ("refresh_token" ).description ("Refresh Token" )
119
+ ),
120
+ responseFields (
121
+ fieldWithPath ("message" ).type (JsonFieldType .STRING )
122
+ .description ("응답 메시지" ),
123
+ fieldWithPath ("body.member_id" ).type (JsonFieldType .NUMBER )
124
+ .description ("회원 식별자" ),
125
+ fieldWithPath ("body.access_token" ).type (JsonFieldType .STRING )
126
+ .description ("OAuth Access Token" ),
127
+ fieldWithPath ("body.refresh_token" ).type (JsonFieldType .STRING )
128
+ .description ("OAuth Refresh Token" )
129
+ )
130
+ ))
131
+ .andExpect (status ().isCreated ());
132
132
}
133
133
134
134
@ DisplayName ("사용자가 로그아웃한다." )
@@ -138,36 +138,36 @@ void logoutTest() throws Exception {
138
138
AuthMember authMemberMock = AuthMember .of (1L , "accessToken" );
139
139
140
140
given (authMemberService .getValidatedMemberId (anyString ()))
141
- .willReturn (authMemberMock );
141
+ .willReturn (authMemberMock );
142
142
143
143
/* When */
144
144
ResultActions actions = mockMvc .perform (
145
- RestDocumentationRequestBuilders .delete ("/auth/v1/logout" )
146
- .header (HttpHeaders .AUTHORIZATION , AUTHORIZATION_HEADER_VALUE )
147
- .contentType (MediaType .APPLICATION_JSON )
145
+ RestDocumentationRequestBuilders .delete ("/auth/v1/logout" )
146
+ .header (HttpHeaders .AUTHORIZATION , AUTHORIZATION_HEADER_VALUE )
147
+ .contentType (MediaType .APPLICATION_JSON )
148
148
);
149
149
150
150
/* Then */
151
151
actions .andDo (print ())
152
- .andDo (document ("auth/logout" ,
153
- preprocessRequest (prettyPrint ()),
154
- preprocessResponse (prettyPrint ()),
155
- responseFields (
156
- fieldWithPath ("message" ).type (JsonFieldType .STRING ).description ("응답 메시지" )
157
- )
158
- ))
159
- .andExpect (status ().isOk ());
152
+ .andDo (document ("auth/logout" ,
153
+ preprocessRequest (prettyPrint ()),
154
+ preprocessResponse (prettyPrint ()),
155
+ responseFields (
156
+ fieldWithPath ("message" ).type (JsonFieldType .STRING ).description ("응답 메시지" )
157
+ )
158
+ ))
159
+ .andExpect (status ().isOk ());
160
160
}
161
161
162
162
// Todo : 이거 정상 작동하지 않아서 리졸버가 동작한다. 이유를 알아보자.
163
163
private void givenMockLoginMember () {
164
164
given (authenticatedArgumentResolver .supportsParameter (any (MethodParameter .class )))
165
- .willReturn (true );
165
+ .willReturn (true );
166
166
given (authenticatedArgumentResolver .resolveArgument (
167
- any (MethodParameter .class ),
168
- any (ModelAndViewContainer .class ),
169
- any (NativeWebRequest .class ),
170
- any (WebDataBinderFactory .class ))
167
+ any (MethodParameter .class ),
168
+ any (ModelAndViewContainer .class ),
169
+ any (NativeWebRequest .class ),
170
+ any (WebDataBinderFactory .class ))
171
171
).willReturn (any (AuthMember .class ));
172
172
}
173
173
}
0 commit comments