28
28
import com .ajou .hertz .domain .user .dto .request .SignUpRequest ;
29
29
import com .ajou .hertz .domain .user .entity .User ;
30
30
import com .ajou .hertz .domain .user .exception .UserEmailDuplicationException ;
31
- import com .ajou .hertz .domain .user .exception .UserIdForbiddenException ;
32
31
import com .ajou .hertz .domain .user .exception .UserKakaoUidDuplicationException ;
33
32
import com .ajou .hertz .domain .user .exception .UserNotFoundByIdException ;
34
33
import com .ajou .hertz .domain .user .exception .UserPhoneDuplicationException ;
@@ -182,7 +181,7 @@ static Stream<Arguments> testDataForCreateNewUserWithKakao() throws Exception {
182
181
given (userQueryService .getById (userId )).willReturn (user );
183
182
184
183
// when
185
- UserDto updatedUserDto = sut .updateContactLink (userId , userId , contactLink );
184
+ UserDto updatedUserDto = sut .updateContactLink (userId , contactLink );
186
185
187
186
// then
188
187
then (userQueryService ).should ().getById (userId );
@@ -198,32 +197,14 @@ static Stream<Arguments> testDataForCreateNewUserWithKakao() throws Exception {
198
197
given (userQueryService .getById (userId )).willThrow (UserNotFoundByIdException .class );
199
198
200
199
// when
201
- Throwable t = catchThrowable (() -> sut .updateContactLink (userId , userId , contactLink ));
200
+ Throwable t = catchThrowable (() -> sut .updateContactLink (userId , contactLink ));
202
201
203
202
// then
204
203
then (userQueryService ).should ().getById (userId );
205
204
verifyEveryMocksShouldHaveNoMoreInteractions ();
206
205
assertThat (t ).isInstanceOf (UserNotFoundByIdException .class );
207
206
}
208
207
209
- @ Test
210
- void 주어진_유저_ID가_API를_호출한_유저의_ID와_일치하지_않는다면_에러가_발생한다 () throws Exception {
211
- // given
212
- Long loginUserId = 1L ;
213
- Long userId = 2L ;
214
- String contactLink = "https://new-contactLink" ;
215
- User user = createUser (userId , "$2a$abc123" , "12345" );
216
- given (userQueryService .getById (userId )).willReturn (user );
217
-
218
- // when
219
- Throwable t = catchThrowable (() -> sut .updateContactLink (loginUserId , userId , contactLink ));
220
-
221
- // then
222
- assertThat (t ).isInstanceOf (UserIdForbiddenException .class );
223
- then (userQueryService ).should ().getById (userId );
224
- verifyEveryMocksShouldHaveNoMoreInteractions ();
225
- }
226
-
227
208
private void verifyEveryMocksShouldHaveNoMoreInteractions () {
228
209
then (userQueryService ).shouldHaveNoMoreInteractions ();
229
210
then (userRepository ).shouldHaveNoMoreInteractions ();
0 commit comments