@@ -51,7 +51,7 @@ class AuthControllerTest extends MockTestConfig {
51
51
private MockMvc mockMvc ;
52
52
53
53
@ Autowired
54
- private AuthService authService ;
54
+ private AuthService mockAuthService ;
55
55
56
56
@ Autowired
57
57
private UserRepository userRepository ;
@@ -63,7 +63,7 @@ class AuthControllerTest extends MockTestConfig {
63
63
private ObjectMapper objectMapper ;
64
64
65
65
@ Autowired
66
- private RankingService rankingService ;
66
+ private RankingService mockRankingService ;
67
67
68
68
@ AfterEach
69
69
void tearDown () {
@@ -127,7 +127,7 @@ void registerSuccessTest() throws Exception {
127
127
.fcmToken ("token" )
128
128
.build ();
129
129
130
- when (authService .register (any (AuthServiceRegisterRequest .class ), any (User .class )))
130
+ when (mockAuthService .register (any (AuthServiceRegisterRequest .class ), any (User .class )))
131
131
.thenReturn (AuthLoginResponse .builder ()
132
132
.accessToken (extendedAtk )
133
133
.refreshToken (extendedRtk )
@@ -152,7 +152,7 @@ void validUserTokenRequestWithDrawThenUserDelete() throws Exception {
152
152
Map <String , String > map = TokenUtil .createTokenMap (savedUser );
153
153
String accessToken = jwtService .generateAccessToken (map , savedUser );
154
154
155
- when (authService .register (any (AuthServiceRegisterRequest .class ), any (User .class ))).thenReturn (AuthLoginResponse .builder ()
155
+ when (mockAuthService .register (any (AuthServiceRegisterRequest .class ), any (User .class ))).thenReturn (AuthLoginResponse .builder ()
156
156
.accessToken (accessToken )
157
157
//.refreshToken(refreshToken)
158
158
.build ()
@@ -162,7 +162,7 @@ void validUserTokenRequestWithDrawThenUserDelete() throws Exception {
162
162
.message ("reason" )
163
163
.build ();
164
164
165
- doNothing ().when (authService ).userDelete (any (User .class ), any (String .class ));
165
+ doNothing ().when (mockAuthService ).userDelete (any (User .class ), any (String .class ));
166
166
167
167
// when
168
168
mockMvc .perform (post ("/auth/delete" )
@@ -182,7 +182,7 @@ void userInfoSuccessTest() throws Exception {
182
182
UserInfoAndRankingResponse savedUser = UserInfoAndRankingResponse .of (userRepository .save (user ), 1L );
183
183
184
184
185
- when (authService .getUserByInfo (user .getPlatformId (), GITHUB )).thenReturn (savedUser );
185
+ when (mockAuthService .getUserByInfo (user .getPlatformId (), GITHUB )).thenReturn (savedUser );
186
186
187
187
HashMap <String , String > map = new HashMap <>();
188
188
map .put ("role" , user .getRole ().name ());
@@ -249,8 +249,8 @@ void userInfoWhenInvalidAuthority() throws Exception {
249
249
String accessToken = jwtService .generateAccessToken (map , savedUser );
250
250
251
251
// when
252
- when (authService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .of (savedUser ));
253
- when (authService .updateUserPage (any (Long .class ))).thenReturn (UserUpdatePageResponse .builder ()
252
+ when (mockAuthService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .of (savedUser ));
253
+ when (mockAuthService .updateUserPage (any (Long .class ))).thenReturn (UserUpdatePageResponse .builder ()
254
254
.name (savedUser .getName ())
255
255
.profileImageUrl (savedUser .getProfileImageUrl ())
256
256
.build ());
@@ -275,7 +275,7 @@ void userInfoWhenInvalidAuthority() throws Exception {
275
275
String accessToken = jwtService .generateAccessToken (map , savedUser );
276
276
277
277
// when
278
- when (authService .findUserInfo (any (User .class ))).thenThrow (new AuthException (ExceptionMessage .UNAUTHORIZED_AUTHORITY ));
278
+ when (mockAuthService .findUserInfo (any (User .class ))).thenThrow (new AuthException (ExceptionMessage .UNAUTHORIZED_AUTHORITY ));
279
279
280
280
// then
281
281
mockMvc .perform (get ("/auth/update" )
@@ -303,8 +303,8 @@ void userInfoWhenInvalidAuthority() throws Exception {
303
303
.blogLink ("https://test.tistory.com/" ).build ())
304
304
.build ();
305
305
// when
306
- when (authService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
307
- doNothing ().when (authService ).updateUser (any (UserUpdateServiceRequest .class ));
306
+ when (mockAuthService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
307
+ doNothing ().when (mockAuthService ).updateUser (any (UserUpdateServiceRequest .class ));
308
308
309
309
// then
310
310
mockMvc .perform (post ("/auth/update" )
@@ -335,8 +335,8 @@ void userInfoWhenInvalidAuthority() throws Exception {
335
335
.build ())
336
336
.build ();
337
337
// when
338
- when (authService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
339
- doNothing ().when (authService ).updateUser (any (UserUpdateServiceRequest .class ));
338
+ when (mockAuthService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
339
+ doNothing ().when (mockAuthService ).updateUser (any (UserUpdateServiceRequest .class ));
340
340
341
341
// then
342
342
mockMvc .perform (post ("/auth/update" )
@@ -365,9 +365,9 @@ void userInfoWhenInvalidAuthority() throws Exception {
365
365
.build ();
366
366
367
367
// when
368
- when (authService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
368
+ when (mockAuthService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
369
369
doThrow (new AuthException (ExceptionMessage .UNAUTHORIZED_AUTHORITY ))
370
- .when (authService )
370
+ .when (mockAuthService )
371
371
.updateUser (any (UserUpdateServiceRequest .class ));
372
372
373
373
// then
@@ -391,8 +391,8 @@ void userInfoWhenInvalidAuthority() throws Exception {
391
391
String accessToken = jwtService .generateAccessToken (map , savedUser );
392
392
393
393
// when
394
- when (authService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
395
- doNothing ().when (authService ).updatePushAlarmYn (any (Long .class ), any (boolean .class ));
394
+ when (mockAuthService .findUserInfo (any (User .class ))).thenReturn (UserInfoResponse .builder ().build ());
395
+ doNothing ().when (mockAuthService ).updatePushAlarmYn (any (Long .class ), any (boolean .class ));
396
396
397
397
// then
398
398
mockMvc .perform (get ("/auth/update/pushAlarmYn" + "/" + true )
@@ -412,7 +412,7 @@ void userInfoWhenInvalidAuthority() throws Exception {
412
412
String accessToken = jwtService .generateAccessToken (map , savedUser );
413
413
414
414
// when
415
- when (authService .findUserInfo (any (User .class ))).thenThrow (new AuthException (ExceptionMessage .UNAUTHORIZED_AUTHORITY ));
415
+ when (mockAuthService .findUserInfo (any (User .class ))).thenThrow (new AuthException (ExceptionMessage .UNAUTHORIZED_AUTHORITY ));
416
416
// then
417
417
mockMvc .perform (get ("/auth/update/pushAlarmYn" + "/" + true )
418
418
.contentType (MediaType .APPLICATION_JSON )
@@ -428,7 +428,7 @@ void userInfoWhenInvalidAuthority() throws Exception {
428
428
// given
429
429
UserNameRequest request = UserFixture .generateUserNameRequest ("이정우" );
430
430
431
- doNothing ().when (authService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
431
+ doNothing ().when (mockAuthService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
432
432
433
433
// when & then
434
434
mockMvc .perform (post ("/auth/check-nickname" )
@@ -447,7 +447,7 @@ void userInfoWhenInvalidAuthority() throws Exception {
447
447
448
448
UserNameRequest request = UserFixture .generateUserNameRequest (inValidName );
449
449
450
- doNothing ().when (authService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
450
+ doNothing ().when (mockAuthService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
451
451
452
452
// when
453
453
mockMvc .perform (post ("/auth/check-nickname" )
@@ -466,7 +466,7 @@ void userInfoWhenInvalidAuthority() throws Exception {
466
466
467
467
UserNameRequest request = UserFixture .generateUserNameRequest (inValidName );
468
468
469
- doNothing ().when (authService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
469
+ doNothing ().when (mockAuthService ).nickNameDuplicationCheck (any (UserNameRequest .class ));
470
470
471
471
// when
472
472
mockMvc .perform (post ("/auth/check-nickname" )
0 commit comments