@@ -144,9 +144,8 @@ void publishOrdersSuccessMessage_UserOnline_SavesAndSendsWebSocket() {
144144 assertThat (saved .isRead ()).isFalse ();
145145
146146 // 웹소켓 전송 확인
147- verify (messagingTemplate ).convertAndSendToUser (
148- eq (testUser .getId ().toString ()),
149- eq ("/notifications" ),
147+ verify (messagingTemplate ).convertAndSend (
148+ eq ("/user/" + testUser .getId () + "/notifications" ),
150149 any (NotificationResponseDto .class )
151150 );
152151 });
@@ -177,10 +176,9 @@ void publishOrdersSuccessMessage_UserOffline_SavesOnlyWithoutWebSocket() {
177176 assertThat (notifications ).hasSize (1 );
178177
179178 // 웹소켓 미전송 확인
180- verify (messagingTemplate , never ()).convertAndSendToUser (
179+ verify (messagingTemplate , never ()).convertAndSend (
181180 anyString (),
182- anyString (),
183- any ()
181+ any (Object .class )
184182 );
185183 });
186184 }
@@ -247,9 +245,8 @@ void publishOrderFailedMessage_UserOnline_SavesAndSendsWebSocket() {
247245 assertThat (saved .getTitle ()).isEqualTo ("주문 및 결제 실패" );
248246 assertThat (saved .getMessage ()).contains ("테스트 이벤트" , "154000원" , "실패" );
249247
250- verify (messagingTemplate ).convertAndSendToUser (
251- eq (testUser .getId ().toString ()),
252- eq ("/notifications" ),
248+ verify (messagingTemplate ).convertAndSend (
249+ eq ("/user/" + testUser .getId () + "/notifications" ),
253250 any (NotificationResponseDto .class )
254251 );
255252 });
@@ -315,9 +312,8 @@ void publishPreRegisterDoneMessage_UserOnline_SavesAndSendsWebSocket() {
315312 assertThat (saved .getTitle ()).isEqualTo ("사전등록 완료" );
316313 assertThat (saved .getMessage ()).contains ("테스트 이벤트" , "사전등록이 완료" );
317314
318- verify (messagingTemplate ).convertAndSendToUser (
319- eq (testUser .getId ().toString ()),
320- eq ("/notifications" ),
315+ verify (messagingTemplate ).convertAndSend (
316+ eq ("/user/" + testUser .getId () + "/notifications" ),
321317 any (NotificationResponseDto .class )
322318 );
323319 });
@@ -382,9 +378,8 @@ void publishQueueEntriesMessage_UserOnline_SavesAndSendsWebSocket() {
382378 assertThat (saved .getTitle ()).isEqualTo ("티켓팅 시작" );
383379 assertThat (saved .getMessage ()).contains ("테스트 이벤트" , "입장 준비가 완료" );
384380
385- verify (messagingTemplate ).convertAndSendToUser (
386- eq (testUser .getId ().toString ()),
387- eq ("/notifications" ),
381+ verify (messagingTemplate ).convertAndSend (
382+ eq ("/user/" + testUser .getId () + "/notifications" ),
388383 any (NotificationResponseDto .class )
389384 );
390385 });
@@ -448,10 +443,9 @@ void publishMessage_NonExistentUser_DoesNotSaveNotification() {
448443 assertThat (notifications ).isEmpty ();
449444
450445 // 웹소켓도 전송되지 않음
451- verify (messagingTemplate , never ()).convertAndSendToUser (
452- anyString (),
446+ verify (messagingTemplate , never ()).convertAndSend (
453447 anyString (),
454- any ()
448+ any (Object . class )
455449 );
456450 });
457451 }
@@ -462,10 +456,9 @@ void publishMessage_WebSocketFails_StillSavesNotification() {
462456 // given
463457 given (sessionManager .isUserOnline (testUser .getId ())).willReturn (true );
464458 willThrow (new RuntimeException ("웹소켓 전송 실패" ))
465- .given (messagingTemplate ).convertAndSendToUser (
466- anyString (),
459+ .given (messagingTemplate ).convertAndSend (
467460 anyString (),
468- any ()
461+ any (Object . class )
469462 );
470463
471464 // when
@@ -486,9 +479,8 @@ void publishMessage_WebSocketFails_StillSavesNotification() {
486479 assertThat (notifications ).hasSize (1 );
487480
488481 // 웹소켓 전송 시도는 있었음
489- verify (messagingTemplate ).convertAndSendToUser (
490- eq (testUser .getId ().toString ()),
491- eq ("/notifications" ),
482+ verify (messagingTemplate ).convertAndSend (
483+ eq ("/user/" + testUser .getId () + "/notifications" ),
492484 any (NotificationResponseDto .class )
493485 );
494486 });
@@ -529,9 +521,8 @@ void publishMultipleMessages_AllProcessedSuccessfully() {
529521 );
530522
531523 // 웹소켓 4번 전송 확인
532- verify (messagingTemplate , times (4 )).convertAndSendToUser (
533- eq (testUser .getId ().toString ()),
534- eq ("/notifications" ),
524+ verify (messagingTemplate , times (4 )).convertAndSend (
525+ eq ("/user/" + testUser .getId () + "/notifications" ),
535526 any (NotificationResponseDto .class )
536527 );
537528 });
0 commit comments