Inject EventPublisher dependency into ChatServiceTest setup for enhanced test isolation and mocking.
This commit is contained in:
@@ -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"});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user