11package com .back .domain .notification .event .study ;
22
3+ import com .back .domain .notification .entity .NotificationSettingType ;
34import com .back .domain .notification .service .NotificationService ;
45import com .back .domain .user .entity .User ;
56import com .back .domain .user .repository .UserRepository ;
@@ -61,12 +62,12 @@ void t1() {
6162 listener .handleStudyRecordCreated (event );
6263
6364 // then
64- verify (notificationService ).createPersonalNotification (
65- eq (testUser ), // receiver (본인)
66- eq (testUser ), // actor (본인)
65+ verify (notificationService ).createSelfNotification (
66+ eq (testUser ), // 본인
6767 anyString (), // title
6868 anyString (), // content
69- eq ("/study/records/100" )
69+ eq ("/study/records/100" ),
70+ eq (NotificationSettingType .SYSTEM )
7071 );
7172 }
7273
@@ -87,8 +88,8 @@ void t2() {
8788 listener .handleStudyRecordCreated (event );
8889
8990 // then
90- verify (notificationService , never ()).createPersonalNotification (
91- any (), any (), anyString (), anyString (), anyString ( )
91+ verify (notificationService , never ()).createSelfNotification (
92+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
9293 );
9394 }
9495
@@ -109,12 +110,12 @@ void t3() {
109110 listener .handleStudyRecordCreated (event );
110111
111112 // then
112- verify (notificationService ).createPersonalNotification (
113- eq (testUser ),
113+ verify (notificationService ).createSelfNotification (
114114 eq (testUser ),
115115 anyString (),
116116 anyString (),
117- eq ("/study/records/100" )
117+ eq ("/study/records/100" ),
118+ eq (NotificationSettingType .SYSTEM )
118119 );
119120 }
120121
@@ -135,12 +136,12 @@ void t4() {
135136 listener .handleStudyRecordCreated (event );
136137
137138 // then
138- verify (notificationService ).createPersonalNotification (
139- eq (testUser ),
139+ verify (notificationService ).createSelfNotification (
140140 eq (testUser ),
141141 anyString (),
142142 anyString (),
143- eq ("/study/records/100" )
143+ eq ("/study/records/100" ),
144+ eq (NotificationSettingType .SYSTEM )
144145 );
145146 }
146147
@@ -164,12 +165,12 @@ void t5() {
164165 listener .handleDailyGoalAchieved (event );
165166
166167 // then
167- verify (notificationService ).createPersonalNotification (
168- eq (testUser ), // receiver (본인)
169- eq (testUser ), // actor (본인)
168+ verify (notificationService ).createSelfNotification (
169+ eq (testUser ), // 본인
170170 anyString (), // title
171171 anyString (), // content
172- eq ("/study/plans?date=" + today )
172+ eq ("/study/plans?date=" + today ),
173+ eq (NotificationSettingType .SYSTEM )
173174 );
174175 }
175176
@@ -191,8 +192,8 @@ void t6() {
191192 listener .handleDailyGoalAchieved (event );
192193
193194 // then
194- verify (notificationService , never ()).createPersonalNotification (
195- any (), any (), anyString (), anyString (), anyString ( )
195+ verify (notificationService , never ()).createSelfNotification (
196+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
196197 );
197198 }
198199
@@ -214,12 +215,12 @@ void t7() {
214215 listener .handleDailyGoalAchieved (event );
215216
216217 // then
217- verify (notificationService ).createPersonalNotification (
218- eq (testUser ),
218+ verify (notificationService ).createSelfNotification (
219219 eq (testUser ),
220220 anyString (),
221221 anyString (),
222- eq ("/study/plans?date=" + today )
222+ eq ("/study/plans?date=" + today ),
223+ eq (NotificationSettingType .SYSTEM )
223224 );
224225 }
225226
@@ -241,12 +242,12 @@ void t8() {
241242 listener .handleDailyGoalAchieved (event );
242243
243244 // then
244- verify (notificationService ).createPersonalNotification (
245- eq (testUser ),
245+ verify (notificationService ).createSelfNotification (
246246 eq (testUser ),
247247 anyString (),
248248 anyString (),
249- eq ("/study/plans?date=" + today )
249+ eq ("/study/plans?date=" + today ),
250+ eq (NotificationSettingType .SYSTEM )
250251 );
251252 }
252253
@@ -268,12 +269,12 @@ void t9() {
268269 listener .handleDailyGoalAchieved (event );
269270
270271 // then
271- verify (notificationService ).createPersonalNotification (
272- eq (testUser ),
272+ verify (notificationService ).createSelfNotification (
273273 eq (testUser ),
274274 anyString (),
275275 anyString (),
276- eq ("/study/plans?date=" + yesterday )
276+ eq ("/study/plans?date=" + yesterday ),
277+ eq (NotificationSettingType .SYSTEM )
277278 );
278279 }
279280
@@ -290,16 +291,16 @@ void t10() {
290291 given (userRepository .findById (1L )).willReturn (Optional .of (testUser ));
291292
292293 willThrow (new RuntimeException ("알림 생성 실패" ))
293- .given (notificationService ).createPersonalNotification (
294- any (), any (), anyString (), anyString (), anyString ( )
294+ .given (notificationService ).createSelfNotification (
295+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
295296 );
296297
297298 // when & then - 예외가 전파되지 않아야 함
298299 assertThatCode (() -> listener .handleStudyRecordCreated (event ))
299300 .doesNotThrowAnyException ();
300301
301- verify (notificationService ).createPersonalNotification (
302- any (), any (), anyString (), anyString (), anyString ( )
302+ verify (notificationService ).createSelfNotification (
303+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
303304 );
304305 }
305306
@@ -315,16 +316,16 @@ void t11() {
315316 given (userRepository .findById (1L )).willReturn (Optional .of (testUser ));
316317
317318 willThrow (new RuntimeException ("알림 생성 실패" ))
318- .given (notificationService ).createPersonalNotification (
319- any (), any (), anyString (), anyString (), anyString ( )
319+ .given (notificationService ).createSelfNotification (
320+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
320321 );
321322
322323 // when & then - 예외가 전파되지 않아야 함
323324 assertThatCode (() -> listener .handleDailyGoalAchieved (event ))
324325 .doesNotThrowAnyException ();
325326
326- verify (notificationService ).createPersonalNotification (
327- any (), any (), anyString (), anyString (), anyString ( )
327+ verify (notificationService ).createSelfNotification (
328+ any (), anyString (), anyString (), anyString (), any ( NotificationSettingType . class )
328329 );
329330 }
330331}
0 commit comments