test: fixed LobbyConnection broadcastEvents test
This commit is contained in:
parent
4ed6d23be6
commit
a056674926
@ -2,6 +2,8 @@ package uulm.teamname.marvelous.server.lobbymanager;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.mockito.MockedStatic;
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
|
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
||||||
@ -167,12 +169,15 @@ class LobbyConnectionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void broadcastEventTest(){
|
void broadcastEventTest(){
|
||||||
var webSock = mock(WebSocket.class);
|
var player1 = mock(WebSocket.class);
|
||||||
|
var player2 = mock(WebSocket.class);
|
||||||
|
var spectator1 = mock(WebSocket.class);
|
||||||
|
var spectator2 = mock(WebSocket.class);
|
||||||
|
|
||||||
Participant playerOne = new Participant(webSock, ParticipantType.PlayerOne, "playerOne");
|
Participant playerOne = new Participant(player1, ParticipantType.PlayerOne, "playerOne");
|
||||||
Participant playerTwo = new Participant(webSock, ParticipantType.PlayerTwo, "playerTwo");
|
Participant playerTwo = new Participant(player2, ParticipantType.PlayerTwo, "playerTwo");
|
||||||
Participant spectatorOne = new Participant(webSock, ParticipantType.Spectator, "spectatorOne");
|
Participant spectatorOne = new Participant(spectator1, ParticipantType.Spectator, "spectatorOne");
|
||||||
Participant spectatorTwo = new Participant(webSock, ParticipantType.Spectator, "spectatorTwo");
|
Participant spectatorTwo = new Participant(spectator2, ParticipantType.Spectator, "spectatorTwo");
|
||||||
|
|
||||||
connection.addPlayer(playerOne);
|
connection.addPlayer(playerOne);
|
||||||
connection.addPlayer(playerTwo);
|
connection.addPlayer(playerTwo);
|
||||||
@ -187,8 +192,9 @@ class LobbyConnectionTest {
|
|||||||
var message = new EventMessage();
|
var message = new EventMessage();
|
||||||
message.messages = events;
|
message.messages = events;
|
||||||
|
|
||||||
//TODO: fix them
|
|
||||||
connection.broadcastEvents(events);
|
connection.broadcastEvents(events);
|
||||||
|
|
||||||
|
|
||||||
verify(sendMessageCallback).accept(playerOne.getConnection(), message);
|
verify(sendMessageCallback).accept(playerOne.getConnection(), message);
|
||||||
verify(sendMessageCallback).accept(playerTwo.getConnection(), message);
|
verify(sendMessageCallback).accept(playerTwo.getConnection(), message);
|
||||||
verify(sendMessageCallback).accept(spectatorOne.getConnection(), message);
|
verify(sendMessageCallback).accept(spectatorOne.getConnection(), message);
|
||||||
|
Loading…
Reference in New Issue
Block a user