@@ -241,6 +241,29 @@ public void securitySetUp() throws Exception {
241
241
.andExpect (status ().isOk ())
242
242
.andExpect (jsonPath ("$.profileImageUrl" ).value (expectedResult .getProfileImageUrl ()));
243
243
then (userCommandService ).should ().updateProfileImageUrl (userId , profileImage );
244
+ verifyEveryMocksShouldHaveNoMoreInteractions ();
245
+ }
246
+
247
+
248
+ void 주어진_연락수단을_새로운_연락수단으로_변경한다 () throws Exception {
249
+ // given
250
+ long userId = 1L ;
251
+ String newContactLink = "https://new-contact-link.com" ;
252
+ UserDto expectedResult = createUserDto (userId );
253
+ UserDetails testUser = createTestUser (userId );
254
+ given (userCommandService .updateContactLink (userId , newContactLink )).willReturn (expectedResult );
255
+
256
+ // when & then
257
+ mvc .perform (
258
+ put ("/api/users/me/contact-link" )
259
+ .header (API_VERSION_HEADER_NAME , 1 )
260
+ .contentType (MediaType .APPLICATION_JSON )
261
+ .content (objectMapper .writeValueAsString (newContactLink ))
262
+ .with (user (testUser ))
263
+ )
264
+ .andExpect (status ().isOk ())
265
+ .andExpect (jsonPath ("$.contactLink" ).value (expectedResult .getContactLink ()));
266
+ then (userCommandService ).should ().updateContactLink (userId , newContactLink );
244
267
verifyEveryMocksShouldHaveNoMoreInteractions ();
245
268
}
246
269
@@ -278,7 +301,7 @@ private UserDto createUserDto(long id) throws Exception {
278
301
LocalDate .of (2024 , 1 , 1 ),
279
302
Gender .ETC ,
280
303
"01012345678" ,
281
- "https://contack -link" ,
304
+ "https://contact -link" ,
282
305
LocalDateTime .of (2024 , 1 , 1 , 0 , 0 )
283
306
);
284
307
}
@@ -290,4 +313,5 @@ private UserDto createUserDto() throws Exception {
290
313
private UserDetails createTestUser (Long userId ) throws Exception {
291
314
return new UserPrincipal (createUserDto (userId ));
292
315
}
316
+
293
317
}
0 commit comments