diff options
Diffstat (limited to 'src/test/java/org')
4 files changed, 27 insertions, 30 deletions
diff --git a/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java b/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java index 1bed446b..a8c6ae6e 100644 --- a/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java +++ b/src/test/java/org/luxons/sevenwonders/game/LobbyTest.java @@ -46,7 +46,7 @@ public class LobbyTest { @Before public void setUp() { - gameOwner = new Player("Game owner", "gameowner"); + gameOwner = new Player("gameowner", "Game owner"); lobby = new Lobby(0, "Test Game", gameOwner, gameDefinition); } @@ -72,22 +72,22 @@ public class LobbyTest { @Test public void isOwner_falseWhenOtherPlayerName() { - Player player = new Player("Test User", "testuser"); + Player player = new Player("testuser", "Test User"); lobby.addPlayer(player); assertFalse(lobby.isOwner(player.getUserName())); } @Test public void addPlayer_success() { - Player player = new Player("Test User", "testuser"); + Player player = new Player("testuser", "Test User"); lobby.addPlayer(player); assertTrue(lobby.containsUser("testuser")); } @Test(expected = PlayerNameAlreadyUsedException.class) public void addPlayer_failsOnSameName() { - Player player = new Player("Test User", "testuser"); - Player player2 = new Player("Test User", "testuser2"); + Player player = new Player("testuser", "Test User"); + Player player2 = new Player("testuser2", "Test User"); lobby.addPlayer(player); lobby.addPlayer(player2); } @@ -103,21 +103,21 @@ public class LobbyTest { // total with owner is the minimum addPlayers(gameDefinition.getMinPlayers() - 1); lobby.startGame(); - lobby.addPlayer(new Player("The Late Guy", "soonerNextTime")); + lobby.addPlayer(new Player("soonerNextTime", "The Late Guy")); } private void addPlayers(int nbPlayers) { for (int i = 0; i < nbPlayers; i++) { - Player player = new Player("Test User " + i, "testuser" + i); + Player player = new Player("testuser" + i, "Test User " + i); lobby.addPlayer(player); } } @Test public void reorderPlayers_failsOnSameName() { - Player player1 = new Player("Test User 1", "testuser1"); - Player player2 = new Player("Test User 2", "testuser2"); - Player player3 = new Player("Test User 3", "testuser3"); + Player player1 = new Player("testuser1", "Test User 1"); + Player player2 = new Player("testuser2", "Test User 2"); + Player player3 = new Player("testuser3", "Test User 3"); lobby.addPlayer(player1); lobby.addPlayer(player2); lobby.addPlayer(player3); @@ -129,9 +129,9 @@ public class LobbyTest { @Test(expected = UnknownPlayerException.class) public void reorderPlayers_failsOnUnknownPlayer() { - Player player1 = new Player("Test User 1", "testuser1"); - Player player2 = new Player("Test User 2", "testuser2"); - Player player3 = new Player("Test User 3", "testuser3"); + Player player1 = new Player("testuser1", "Test User 1"); + Player player2 = new Player("testuser2", "Test User 2"); + Player player3 = new Player("testuser3", "Test User 3"); lobby.addPlayer(player1); lobby.addPlayer(player2); lobby.addPlayer(player3); diff --git a/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java b/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java index 35b2df7d..675c77de 100644 --- a/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java +++ b/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java @@ -63,7 +63,7 @@ public class BoardTest { } @Theory - public void removeOld_successfulWhenNotTooMuch(@FromDataPoints("gold") int initialGold, + public void removeGold_successfulWhenNotTooMuch(@FromDataPoints("gold") int initialGold, @FromDataPoints("gold") int goldRemoved) { assumeTrue(goldRemoved >= 0); assumeTrue(initialGold >= goldRemoved); @@ -74,7 +74,7 @@ public class BoardTest { } @Theory - public void removeOld_failsWhenTooMuch(@FromDataPoints("gold") int initialGold, + public void removeGold_failsWhenTooMuch(@FromDataPoints("gold") int initialGold, @FromDataPoints("gold") int goldRemoved) { assumeTrue(goldRemoved >= 0); assumeTrue(initialGold < goldRemoved); diff --git a/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java b/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java index 68c9a676..17940361 100644 --- a/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java +++ b/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java @@ -30,7 +30,7 @@ public class ProductionIncreaseSerializerTest { .create(); } - private static ProductionIncrease create(int wood, int stone, int clay, int glass) { + private static ProductionIncrease create(int wood, int stone, int clay) { Production production = new Production(); if (wood > 0) { production.addFixedResource(ResourceType.WOOD, wood); @@ -41,9 +41,6 @@ public class ProductionIncreaseSerializerTest { if (clay > 0) { production.addFixedResource(ResourceType.CLAY, clay); } - if (glass > 0) { - production.addFixedResource(ResourceType.GLASS, glass); - } ProductionIncrease prodIncrease = new ProductionIncrease(); prodIncrease.setProduction(production); return prodIncrease; @@ -70,25 +67,25 @@ public class ProductionIncreaseSerializerTest { @Test public void serialize_singleType() { - ProductionIncrease prodIncrease = create(1, 0, 0, 0); + ProductionIncrease prodIncrease = create(1, 0, 0); assertEquals("\"W\"", gson.toJson(prodIncrease, ProductionIncrease.class)); } @Test public void serialize_multipleTimesSameType() { - ProductionIncrease prodIncrease = create(3, 0, 0, 0); + ProductionIncrease prodIncrease = create(3, 0, 0); assertEquals("\"WWW\"", gson.toJson(prodIncrease, ProductionIncrease.class)); } @Test public void serialize_mixedTypes() { - ProductionIncrease prodIncrease = create(1, 1, 1, 0); + ProductionIncrease prodIncrease = create(1, 1, 1); assertEquals("\"WSC\"", gson.toJson(prodIncrease, ProductionIncrease.class)); } @Test public void serialize_mixedTypesMultiple() { - ProductionIncrease prodIncrease = create(2, 1, 2, 0); + ProductionIncrease prodIncrease = create(2, 1, 2); assertEquals("\"WWSCC\"", gson.toJson(prodIncrease, ProductionIncrease.class)); } @@ -125,7 +122,7 @@ public class ProductionIncreaseSerializerTest { @Test(expected = IllegalArgumentException.class) public void serialize_failIfMixedFixedAndChoices() { - ProductionIncrease prodIncrease = create(1, 0, 0, 0); + ProductionIncrease prodIncrease = create(1, 0, 0); prodIncrease.getProduction().addChoice(ResourceType.WOOD, ResourceType.CLAY); gson.toJson(prodIncrease, ProductionIncrease.class); } @@ -153,25 +150,25 @@ public class ProductionIncreaseSerializerTest { @Test public void deserialize_singleType() { - ProductionIncrease prodIncrease = create(1, 0, 0, 0); + ProductionIncrease prodIncrease = create(1, 0, 0); assertEquals(prodIncrease, gson.fromJson("\"W\"", ProductionIncrease.class)); } @Test public void deserialize_multipleTimesSameType() { - ProductionIncrease prodIncrease = create(3, 0, 0, 0); + ProductionIncrease prodIncrease = create(3, 0, 0); assertEquals(prodIncrease, gson.fromJson("\"WWW\"", ProductionIncrease.class)); } @Test public void deserialize_mixedTypes() { - ProductionIncrease prodIncrease = create(1, 1, 1, 0); + ProductionIncrease prodIncrease = create(1, 1, 1); assertEquals(prodIncrease, gson.fromJson("\"WCS\"", ProductionIncrease.class)); } @Test public void deserialize_mixedTypes_unordered() { - ProductionIncrease prodIncrease = create(1, 3, 2, 0); + ProductionIncrease prodIncrease = create(1, 3, 2); assertEquals(prodIncrease, gson.fromJson("\"SCWCSS\"", ProductionIncrease.class)); } diff --git a/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java b/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java index 1f2df0ab..f782118d 100644 --- a/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java +++ b/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java @@ -41,7 +41,7 @@ public class TestUtils { for (int i = 0; i < count; i++) { String userName = "testUser" + i; String displayName = "Test User " + i; - Player player = new Player(displayName, userName); + Player player = new Player(userName, displayName); players.add(player); } return players; @@ -53,7 +53,7 @@ public class TestUtils { String userName = "testUser" + initialResource.getSymbol(); String displayName = "Test User " + initialResource.getSymbol(); - Player player = new Player(displayName, userName); + Player player = new Player(userName, displayName); return new Board(wonder, player, settings); } |