1
1
package com .aliens .backend .event ;
2
2
3
3
import com .aliens .backend .auth .domain .Member ;
4
+ import com .aliens .backend .chat .controller .dto .event .ChatRoomBlockEvent ;
4
5
import com .aliens .backend .chat .controller .dto .event .ChatRoomCreationEvent ;
5
6
import com .aliens .backend .chat .service .ChatService ;
6
7
import com .aliens .backend .chat .service .model .MemberPair ;
20
21
import java .util .Set ;
21
22
22
23
import static org .mockito .ArgumentMatchers .any ;
24
+ import static org .mockito .Mockito .doNothing ;
23
25
import static org .mockito .Mockito .verify ;
24
26
import static org .mockito .internal .verification .VerificationModeFactory .times ;
25
27
@@ -33,6 +35,7 @@ class EventPublisherTest extends BaseServiceTest {
33
35
String givenType = "normal" ;
34
36
String giveContent = "content" ;
35
37
String givenToken = "token" ;
38
+ Long givenChatRoomId = 1L ;
36
39
37
40
@ Test
38
41
@ DisplayName ("단일 메시지 이벤트 발행 및 전송 " )
@@ -76,6 +79,20 @@ void handleChatRoomCreationEventTest() {
76
79
verify (chatService , times (1 )).handleChatRoomCreationEvent (event );
77
80
}
78
81
82
+ @ Test
83
+ @ DisplayName ("채팅방 차단 이벤트 발행 및 처리" )
84
+ void handleChatRoomBlockEventTest () {
85
+ // Given
86
+ ChatRoomBlockEvent event = new ChatRoomBlockEvent (givenChatRoomId );
87
+ doNothing ().when (chatService ).handleChatRoomBlockEvent (event );
88
+
89
+ // When
90
+ publisher .publishEvent (event );
91
+
92
+ // Then
93
+ verify (chatService , times (1 )).handleChatRoomBlockEvent (event );
94
+ }
95
+
79
96
private Set <MemberPair > generateMultiMemberPair (Integer memberCount ) {
80
97
List <Member > members = dummyGenerator .generateMultiMember (memberCount );
81
98
Set <MemberPair > memberPairs = new HashSet <>();
0 commit comments