|
5 | 5 | import com.back.domain.chat.room.service.RoomChatService; |
6 | 6 | import com.back.global.exception.CustomException; |
7 | 7 | import com.back.global.exception.ErrorCode; |
8 | | -import com.back.global.security.CustomUserDetails; |
9 | | -import com.back.global.security.JwtTokenProvider; |
| 8 | +import com.back.global.security.jwt.JwtTokenProvider; |
| 9 | +import com.back.global.security.user.CustomUserDetails; |
10 | 10 | import org.junit.jupiter.api.DisplayName; |
11 | 11 | import org.junit.jupiter.api.Test; |
12 | 12 |
|
@@ -64,7 +64,7 @@ void t1() throws Exception { |
64 | 64 | .willReturn(mockResponse); |
65 | 65 |
|
66 | 66 | // JWT 관련 스텁 |
67 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 67 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
68 | 68 |
|
69 | 69 | CustomUserDetails mockUser = CustomUserDetails.builder() |
70 | 70 | .userId(1L) |
@@ -124,7 +124,7 @@ void t3() throws Exception { |
124 | 124 | @Test |
125 | 125 | @DisplayName("잘못된 JWT 토큰으로 요청 - 401 Unauthorized") |
126 | 126 | void t4() throws Exception { |
127 | | - given(jwtTokenProvider.validateToken("invalidtoken")).willReturn(false); |
| 127 | + given(jwtTokenProvider.validateAccessToken("invalidtoken")).willReturn(false); |
128 | 128 |
|
129 | 129 | mockMvc.perform(get("/api/rooms/1/messages") |
130 | 130 | .param("page", "0") |
@@ -174,7 +174,7 @@ void t6() throws Exception { |
174 | 174 | given(roomChatService.clearRoomChat(roomId, userId)).willReturn(clearedByInfo); |
175 | 175 |
|
176 | 176 | // JWT 관련 스텁 |
177 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 177 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
178 | 178 |
|
179 | 179 | CustomUserDetails mockUser = CustomUserDetails.builder() |
180 | 180 | .userId(userId) |
@@ -228,7 +228,7 @@ void t7() throws Exception { |
228 | 228 | given(roomChatService.clearRoomChat(roomId, userId)).willReturn(clearedByInfo); |
229 | 229 |
|
230 | 230 | // JWT 관련 스텁 |
231 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 231 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
232 | 232 |
|
233 | 233 | CustomUserDetails mockUser = CustomUserDetails.builder() |
234 | 234 | .userId(userId) |
@@ -266,7 +266,7 @@ void t8() throws Exception { |
266 | 266 | .given(roomChatService).clearRoomChat(roomId, userId); |
267 | 267 |
|
268 | 268 | // JWT 관련 스텁 |
269 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 269 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
270 | 270 |
|
271 | 271 | CustomUserDetails mockUser = CustomUserDetails.builder() |
272 | 272 | .userId(userId) |
@@ -303,7 +303,7 @@ void t9() throws Exception { |
303 | 303 | willThrow(new CustomException(ErrorCode.ROOM_NOT_FOUND)) |
304 | 304 | .given(roomChatService).clearRoomChat(nonExistentRoomId, userId); |
305 | 305 |
|
306 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 306 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
307 | 307 |
|
308 | 308 | CustomUserDetails mockUser = CustomUserDetails.builder() |
309 | 309 | .userId(userId) |
@@ -340,7 +340,7 @@ void t10() throws Exception { |
340 | 340 | willThrow(new CustomException(ErrorCode.INVALID_DELETE_CONFIRMATION)) |
341 | 341 | .given(roomChatService).clearRoomChat(roomId, userId); |
342 | 342 |
|
343 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 343 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
344 | 344 |
|
345 | 345 | CustomUserDetails mockUser = CustomUserDetails.builder() |
346 | 346 | .userId(userId) |
@@ -374,7 +374,7 @@ void t11() throws Exception { |
374 | 374 | Long roomId = 1L; |
375 | 375 |
|
376 | 376 | // JWT 관련 스텁 |
377 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 377 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
378 | 378 |
|
379 | 379 | CustomUserDetails mockUser = CustomUserDetails.builder() |
380 | 380 | .userId(1L) |
@@ -410,7 +410,7 @@ void t12() throws Exception { |
410 | 410 | willThrow(new CustomException(ErrorCode.NOT_ROOM_MEMBER)) |
411 | 411 | .given(roomChatService).clearRoomChat(roomId, userId); |
412 | 412 |
|
413 | | - given(jwtTokenProvider.validateToken("faketoken")).willReturn(true); |
| 413 | + given(jwtTokenProvider.validateAccessToken("faketoken")).willReturn(true); |
414 | 414 |
|
415 | 415 | CustomUserDetails mockUser = CustomUserDetails.builder() |
416 | 416 | .userId(userId) |
|
0 commit comments