From c316cd7d87d819dc3f800c56b97bf4e0234888f6 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Mon, 23 Jan 2017 00:34:12 +0100 Subject: Add test checking the switch to PLAYING state --- backend/src/main/java/org/luxons/sevenwonders/game/Lobby.java | 4 ++++ .../src/test/java/org/luxons/sevenwonders/game/LobbyTest.java | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'backend/src') diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/Lobby.java b/backend/src/main/java/org/luxons/sevenwonders/game/Lobby.java index 6975349a..b90283a8 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/Lobby.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/Lobby.java @@ -52,6 +52,10 @@ public class Lobby { this.settings = settings; } + public State getState() { + return state; + } + public synchronized void addPlayer(Player player) throws GameAlreadyStartedException, PlayerOverflowException { if (hasStarted()) { throw new GameAlreadyStartedException(); diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java index 4a12592e..b959ed96 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java @@ -167,4 +167,13 @@ public class LobbyTest { addPlayers(nbPlayers - 1); lobby.startGame(); } + + @Test + public void startGame_switchesState() { + assertTrue(lobby.getState() == State.LOBBY); + // there is already the owner + addPlayers(gameDefinition.getMinPlayers() - 1); + lobby.startGame(); + assertTrue(lobby.getState() == State.PLAYING); + } } \ No newline at end of file -- cgit