|
33 | 33 | import java.nio.charset.StandardCharsets;
|
34 | 34 | import java.util.Map;
|
35 | 35 |
|
36 |
| -import static org.junit.jupiter.api.Assertions.assertEquals; |
37 |
| -import static org.junit.jupiter.api.Assertions.assertTrue; |
| 36 | +import static org.junit.jupiter.api.Assertions.*; |
38 | 37 | import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName;
|
39 | 38 | import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders;
|
40 | 39 | import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
|
43 | 42 | import static org.springframework.restdocs.payload.PayloadDocumentation.relaxedResponseFields;
|
44 | 43 | import static org.springframework.restdocs.request.RequestDocumentation.formParameters;
|
45 | 44 | import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
|
| 45 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
| 46 | +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; |
46 | 47 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
47 | 48 |
|
48 | 49 | @ExtendWith(RestDocumentationExtension.class)
|
@@ -196,6 +197,12 @@ public void test_SameAppTokensUseSameAccessToken_EXPOSED() throws Exception {
|
196 | 197 | jsonResponse = new JSONObject(responseString);
|
197 | 198 | String accessToken2 = jsonResponse.getJSONObject("data").getString("access_token");
|
198 | 199 |
|
| 200 | + if(accessToken2.equals(accessToken)){ |
| 201 | + assertNotEquals("The new access_token issued with a refresh_token should not be the same value as the existing access_token.", accessToken2, accessToken); |
| 202 | + }else{ |
| 203 | + assertTrue(true, "성공"); |
| 204 | + } |
| 205 | + |
199 | 206 | /*
|
200 | 207 | * LOGOUT
|
201 | 208 | *
|
@@ -246,7 +253,12 @@ public void test_SameAppTokensUseSameAccessToken_EXPOSED() throws Exception {
|
246 | 253 | refreshToken = jsonResponse.getJSONObject("data").getString("refresh_token");
|
247 | 254 | String finalAccessTokenForAppToken1 = jsonResponse.getJSONObject("data").getString("access_token");
|
248 | 255 |
|
249 |
| - |
| 256 | + // Check the availability of the access token for APPTOKENAAA |
| 257 | + mockMvc.perform(get("/api/v1/customers/me") |
| 258 | + .contentType(MediaType.APPLICATION_JSON) |
| 259 | + .header(HttpHeaders.AUTHORIZATION, "Bearer " + finalAccessTokenForAppToken1)) |
| 260 | + .andDo(print()) |
| 261 | + .andExpect(status().isOk()); |
250 | 262 |
|
251 | 263 | if(!accessTokenForAppToken1.equals(finalAccessTokenForAppToken1)){
|
252 | 264 | assertEquals("The Access Token corresponding to the initial app token was different.", accessTokenForAppToken1, finalAccessTokenForAppToken1);
|
@@ -357,6 +369,12 @@ public void test_SameAppTokensUseSameAccessToken_ORIGINAL() throws Exception {
|
357 | 369 | String accessToken2 = jsonResponse.getString("access_token");
|
358 | 370 |
|
359 | 371 |
|
| 372 | + if(accessToken2.equals(accessToken)){ |
| 373 | + assertNotEquals("The new access_token issued with a refresh_token should not be the same value as the existing access_token.", accessToken2, accessToken); |
| 374 | + }else{ |
| 375 | + assertTrue(true, "성공"); |
| 376 | + } |
| 377 | + |
360 | 378 | mockMvc.perform(RestDocumentationRequestBuilders.get("/api/v1/customers/me/logout")
|
361 | 379 | .contentType(MediaType.APPLICATION_JSON)
|
362 | 380 | .header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken2))
|
@@ -399,7 +417,12 @@ public void test_SameAppTokensUseSameAccessToken_ORIGINAL() throws Exception {
|
399 | 417 | String finalAccessTokenForAppToken1 = jsonResponse.getString("access_token");
|
400 | 418 |
|
401 | 419 |
|
402 |
| - |
| 420 | + // Check the availability of the access token for APPTOKENAAA |
| 421 | + mockMvc.perform(get("/api/v1/customers/me") |
| 422 | + .contentType(MediaType.APPLICATION_JSON) |
| 423 | + .header(HttpHeaders.AUTHORIZATION, "Bearer " + finalAccessTokenForAppToken1)) |
| 424 | + .andDo(print()) |
| 425 | + .andExpect(status().isOk()); |
403 | 426 |
|
404 | 427 | if(!accessTokenForAppToken1.equals(finalAccessTokenForAppToken1)){
|
405 | 428 | assertEquals("The Access Token corresponding to the initial app token was different.", accessTokenForAppToken1, finalAccessTokenForAppToken1);
|
|
0 commit comments