33import static org .junit .jupiter .api .Assertions .assertEquals ;
44import static org .junit .jupiter .api .Assertions .assertNotNull ;
55import static org .junit .jupiter .api .Assertions .assertTrue ;
6+ import static org .mockito .ArgumentMatchers .any ;
7+ import static org .mockito .ArgumentMatchers .eq ;
68import static org .mockito .Mockito .doNothing ;
79import static org .mockito .Mockito .mock ;
810import static org .mockito .Mockito .times ;
3537import org .mockito .InjectMocks ;
3638import org .mockito .Mock ;
3739import org .mockito .junit .jupiter .MockitoExtension ;
40+ import org .mockito .junit .jupiter .MockitoSettings ;
41+ import org .mockito .quality .Strictness ;
3842import org .springframework .http .HttpStatus ;
3943import org .springframework .http .ResponseEntity ;
4044
@@ -140,6 +144,7 @@ void changePassword_success() {
140144 @ DisplayName ("프로필 생성 테스트" )
141145 class CreateProfileTest {
142146
147+ @ MockitoSettings (strictness = Strictness .LENIENT )
143148 @ Test
144149 @ DisplayName ("성공 - 프로필 생성" )
145150 void createProfile_success () {
@@ -150,16 +155,31 @@ void createProfile_success() {
150155 Profile mockProfile = mock (Profile .class );
151156 when (mockProfile .getId ()).thenReturn (10L );
152157 when (mockProfile .isActive ()).thenReturn (true );
158+ when (mockProfile .getType ()).thenReturn (ProfileType .CUSTOMER );
159+ when (mockProfile .getUser ()).thenReturn (mockUser );
160+ when (mockProfile .getType ()).thenReturn (ProfileType .CUSTOMER );
153161
154162 CustomerProfileCreateData profileData = new CustomerProfileCreateData (
155163 "닉네임" , null , "01012345678"
156164 );
157165
158166 CreateProfileRequest request = new CreateProfileRequest (ProfileType .CUSTOMER , profileData );
159167
160- when (profileService .createProfile (mockUser , ProfileType .CUSTOMER , profileData ))
168+ when (profileService .createProfile (eq ( mockUser ), eq ( ProfileType .CUSTOMER ), any () ))
161169 .thenReturn (mockProfile );
162170
171+ when (rq .getDeviceId ()).thenReturn ("device123" );
172+ when (rq .getAccessTokenFromHeader ()).thenReturn ("oldAccessToken" );
173+
174+ SwitchProfileResult switchResult = new SwitchProfileResult (
175+ SwitchProfileResponse .builder ().build (),
176+ "newAccessToken"
177+ );
178+
179+ when (authService .switchProfileWithTokenReissue (
180+ any (Long .class ), any (ProfileType .class ), any (String .class ), any (String .class )
181+ )).thenReturn (switchResult );
182+
163183 ResponseEntity <ApiResponse <CreateProfileResponse >> response = userController .createProfile (
164184 request );
165185
0 commit comments