Inject EventPublisher dependency into ChatServiceTest setup for enhanced test isolation and mocking.
This commit is contained in:
parent
4f67228c39
commit
9757ce2ffa
|
|
@ -3,6 +3,7 @@ package com.alttd.altitudeweb.services.chat;
|
|||
import com.alttd.altitudeweb.controllers.chat.ChatMessage;
|
||||
import com.alttd.altitudeweb.controllers.chat.ChatMessageType;
|
||||
import com.alttd.altitudeweb.model.PermissionClaimDto;
|
||||
import com.alttd.altitudeweb.services.chat.event_publisher.EventPublisher;
|
||||
import com.alttd.altitudeweb.services.chat.event_publisher.EventUser;
|
||||
import com.alttd.altitudeweb.services.chat.event_publisher.MessageForUser;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
|
@ -25,7 +26,8 @@ class ChatServiceTest {
|
|||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
chatService = spy(new ChatService());
|
||||
EventPublisher eventPublisher = mock(EventPublisher.class);
|
||||
chatService = spy(new ChatService(eventPublisher));
|
||||
ReflectionTestUtils.setField(chatService, "allowedServers", new String[]{"server1"});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user