test: fixed LobbyManagerTest to not run lobbies
This commit is contained in:
parent
472a1e70ce
commit
8dab25ca8d
@ -1,9 +1,12 @@
|
|||||||
package uulm.teamname.marvelous.server.lobbymanager;
|
package uulm.teamname.marvelous.server.lobbymanager;
|
||||||
|
|
||||||
import org.java_websocket.WebSocket;
|
import org.java_websocket.WebSocket;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.MockedStatic;
|
||||||
|
import org.mockito.Mockito;
|
||||||
import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage;
|
import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage;
|
||||||
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
|
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
|
||||||
import uulm.teamname.marvelous.gamelibrary.messages.RoleEnum;
|
import uulm.teamname.marvelous.gamelibrary.messages.RoleEnum;
|
||||||
@ -33,6 +36,9 @@ class LobbyManagerTest {
|
|||||||
Participant player2Participant;
|
Participant player2Participant;
|
||||||
Participant player3Participant;
|
Participant player3Participant;
|
||||||
|
|
||||||
|
LobbyRunner lobbyRunner;
|
||||||
|
MockedStatic<LobbyRunner> lobbyRunnerMockedStatic;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
|
|
||||||
@ -67,6 +73,17 @@ class LobbyManagerTest {
|
|||||||
player3,
|
player3,
|
||||||
ParticipantType.PlayerOne,
|
ParticipantType.PlayerOne,
|
||||||
"AwesomestAwesomePlayer");
|
"AwesomestAwesomePlayer");
|
||||||
|
|
||||||
|
lobbyRunner = spy(LobbyRunner.getInstance());
|
||||||
|
doNothing().when(lobbyRunner).startLobby(any(LobbyConnection.class));
|
||||||
|
|
||||||
|
lobbyRunnerMockedStatic = Mockito.mockStatic(LobbyRunner.class);
|
||||||
|
lobbyRunnerMockedStatic.when(LobbyRunner::getInstance).thenReturn(lobbyRunner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void afterEach() {
|
||||||
|
lobbyRunnerMockedStatic.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -77,6 +94,9 @@ class LobbyManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
@DisplayName("When a participant is added, a new Lobby is created")
|
@DisplayName("When a participant is added, a new Lobby is created")
|
||||||
void lobbyCreationTest() {
|
void lobbyCreationTest() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var message = new PlayerReadyMessage();
|
var message = new PlayerReadyMessage();
|
||||||
message.role = RoleEnum.PLAYER;
|
message.role = RoleEnum.PLAYER;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user