diff options
author | jbion <joffrey.bion@amadeus.com> | 2016-12-30 02:29:17 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2016-12-30 02:29:17 +0100 |
commit | 236ea7b8072df68d50fc0e1760d56672b851d8b6 (patch) | |
tree | ecc60c39b4f8f362a08f9536413a482a9e86f4ba /src/test/java/org | |
parent | Auto-subscribe to error channel in test page (diff) | |
download | seven-wonders-236ea7b8072df68d50fc0e1760d56672b851d8b6.tar.gz seven-wonders-236ea7b8072df68d50fc0e1760d56672b851d8b6.tar.bz2 seven-wonders-236ea7b8072df68d50fc0e1760d56672b851d8b6.zip |
Refactor LobbyController to make the code simpler
This change gets rid of session access and makes use of a player repository. This allows for encapsulated and testable Player management.
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/luxons/sevenwonders/game/LobbyTest.java | 6 | ||||
-rw-r--r-- | src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java b/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java index 65069b88..1bed446b 100644 --- a/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java +++ b/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java @@ -102,7 +102,7 @@ public class LobbyTest { public void addPlayer_failWhenGameStarted() { // total with owner is the minimum addPlayers(gameDefinition.getMinPlayers() - 1); - lobby.startGame(new Settings()); + lobby.startGame(); lobby.addPlayer(new Player("The Late Guy", "soonerNextTime")); } @@ -144,7 +144,7 @@ public class LobbyTest { thrown.expect(PlayerUnderflowException.class); // there is already the owner addPlayers(nbPlayers - 1); - lobby.startGame(new Settings()); + lobby.startGame(); } @Theory @@ -153,6 +153,6 @@ public class LobbyTest { assumeTrue(nbPlayers < gameDefinition.getMaxPlayers()); // there is already the owner addPlayers(nbPlayers - 1); - lobby.startGame(new Settings()); + lobby.startGame(); } }
\ No newline at end of file diff --git a/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java b/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java index 75839f16..35b9f7c0 100644 --- a/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java +++ b/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.luxons.sevenwonders.game.Game; import org.luxons.sevenwonders.game.Lobby; import org.luxons.sevenwonders.game.Player; -import org.luxons.sevenwonders.game.Settings; import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.repositories.GameRepository; import org.luxons.sevenwonders.repositories.GameRepository.GameNotFoundException; @@ -39,11 +38,10 @@ public class DestinationAccessValidatorTest { return lobby; } - private Game createGame(String gameName, String ownerUserName, String... otherPlayers) { + private void createGame(String gameName, String ownerUserName, String... otherPlayers) { Lobby lobby = createLobby(gameName, ownerUserName, otherPlayers); - Game game = lobby.startGame(new Settings()); + Game game = lobby.startGame(); gameRepository.add(game); - return game; } @Test |