summaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2017-01-12 22:59:21 +0100
committerjbion <joffrey.bion@amadeus.com>2017-01-12 22:59:21 +0100
commit1431bff18c30a4c1205fb19c83c307a3181525ee (patch)
tree55954a23d923c8b1291783b626ddcea8a2268dd1 /src/test/java/org
parentAdd multiple ways to pick the side of the wonder (diff)
downloadseven-wonders-1431bff18c30a4c1205fb19c83c307a3181525ee.tar.gz
seven-wonders-1431bff18c30a4c1205fb19c83c307a3181525ee.tar.bz2
seven-wonders-1431bff18c30a4c1205fb19c83c307a3181525ee.zip
Separate CustomizableSettings and actual Settings
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java16
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java8
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java2
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java5
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java3
-rw-r--r--src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java5
6 files changed, 24 insertions, 15 deletions
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 675c77de..f9117146 100644
--- a/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java
+++ b/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java
@@ -11,6 +11,7 @@ import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.luxons.sevenwonders.game.Settings;
+import org.luxons.sevenwonders.game.api.CustomizableSettings;
import org.luxons.sevenwonders.game.boards.Board.InsufficientFundsException;
import org.luxons.sevenwonders.game.cards.Color;
import org.luxons.sevenwonders.game.resources.ResourceType;
@@ -49,15 +50,16 @@ public class BoardTest {
@Theory
public void initialGold_respectsSettings(@FromDataPoints("gold") int goldAmountInSettings) {
- Settings settings = new Settings();
- settings.setInitialGold(goldAmountInSettings);
+ CustomizableSettings customSettings = new CustomizableSettings();
+ customSettings.setInitialGold(goldAmountInSettings);
+ Settings settings = new Settings(5, customSettings);
Board board = new Board(TestUtils.createWonder(), null, settings);
assertEquals(goldAmountInSettings, board.getGold());
}
@Theory
public void initialProduction_containsInitialResource(ResourceType type) {
- Board board = new Board(TestUtils.createWonder(type), null, new Settings());
+ Board board = new Board(TestUtils.createWonder(type), null, new Settings(5));
Resources resources = TestUtils.createResources(type);
assertTrue(board.getProduction().contains(resources));
}
@@ -67,7 +69,7 @@ public class BoardTest {
@FromDataPoints("gold") int goldRemoved) {
assumeTrue(goldRemoved >= 0);
assumeTrue(initialGold >= goldRemoved);
- Board board = new Board(TestUtils.createWonder(), null, new Settings());
+ Board board = new Board(TestUtils.createWonder(), null, new Settings(5));
board.setGold(initialGold);
board.removeGold(goldRemoved);
assertEquals(initialGold - goldRemoved, board.getGold());
@@ -79,7 +81,7 @@ public class BoardTest {
assumeTrue(goldRemoved >= 0);
assumeTrue(initialGold < goldRemoved);
thrown.expect(InsufficientFundsException.class);
- Board board = new Board(TestUtils.createWonder(), null, new Settings());
+ Board board = new Board(TestUtils.createWonder(), null, new Settings(5));
board.setGold(initialGold);
board.removeGold(goldRemoved);
}
@@ -87,7 +89,7 @@ public class BoardTest {
@Theory
public void getNbCardsOfColor_properCount_singleColor(ResourceType type, @FromDataPoints("nbCards") int nbCards,
@FromDataPoints("nbCards") int nbOtherCards, Color color) {
- Board board = new Board(TestUtils.createWonder(type), null, new Settings());
+ Board board = new Board(TestUtils.createWonder(type), null, new Settings(5));
TestUtils.addCards(board, nbCards, nbOtherCards, color);
assertEquals(nbCards, board.getNbCardsOfColor(Collections.singletonList(color)));
}
@@ -96,7 +98,7 @@ public class BoardTest {
public void getNbCardsOfColor_properCount_multiColors(ResourceType type, @FromDataPoints("nbCards") int nbCards1,
@FromDataPoints("nbCards") int nbCards2, @FromDataPoints("nbCards") int nbOtherCards, Color color1,
Color color2) {
- Board board = new Board(TestUtils.createWonder(type), null, new Settings());
+ Board board = new Board(TestUtils.createWonder(type), null, new Settings(5));
TestUtils.addCards(board, nbCards1, color1);
TestUtils.addCards(board, nbCards2, color2);
TestUtils.addCards(board, nbOtherCards, TestUtils.getDifferentColorFrom(color1, color2));
diff --git a/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java b/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
index 9a1fcb65..7ef253db 100644
--- a/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
+++ b/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
@@ -11,6 +11,7 @@ import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.luxons.sevenwonders.game.Settings;
+import org.luxons.sevenwonders.game.api.CustomizableSettings;
import org.luxons.sevenwonders.game.boards.Military.UnknownAgeException;
import static org.junit.Assert.*;
@@ -35,10 +36,11 @@ public class MilitaryTest {
Map<Integer, Integer> wonPointsPerAge = new HashMap<>();
wonPointsPerAge.put(age, nbPointsPerVictory);
- Settings settings = new Settings();
- settings.setWonPointsPerVictoryPerAge(wonPointsPerAge);
- settings.setLostPointsPerDefeat(nbPointsPerDefeat);
+ CustomizableSettings customSettings = new CustomizableSettings();
+ customSettings.setWonPointsPerVictoryPerAge(wonPointsPerAge);
+ customSettings.setLostPointsPerDefeat(nbPointsPerDefeat);
+ Settings settings = new Settings(5, customSettings);
return new Military(settings);
}
diff --git a/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java b/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java
index 0748f005..4a481442 100644
--- a/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java
+++ b/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java
@@ -25,7 +25,7 @@ public class CardTest {
@Before
public void initBoard() {
- Settings settings = new Settings();
+ Settings settings = new Settings(5);
List<Board> boards = new ArrayList<>(3);
boards.add(new Board(new Wonder("TestWonder", ResourceType.WOOD), null, settings));
diff --git a/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java b/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java
index d610d793..5acc09df 100644
--- a/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java
+++ b/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java
@@ -6,6 +6,7 @@ import org.junit.Test;
import org.luxons.sevenwonders.game.Game;
import org.luxons.sevenwonders.game.Player;
import org.luxons.sevenwonders.game.Settings;
+import org.luxons.sevenwonders.game.api.CustomizableSettings;
import org.luxons.sevenwonders.game.test.TestUtils;
import static org.junit.Assert.*;
@@ -17,10 +18,8 @@ public class GameDefinitionTest {
GameDefinition gameDefinition = new GameDefinitionLoader().getGameDefinition();
assertNotNull(gameDefinition);
- Settings settings = new Settings();
- settings.setNbPlayers(7);
List<Player> players = TestUtils.createPlayers(7);
- Game game = gameDefinition.initGame(0, settings, players);
+ Game game = gameDefinition.initGame(0, new CustomizableSettings(), players);
assertNotNull(game);
}
} \ No newline at end of file
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 f782118d..6e8c1335 100644
--- a/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java
+++ b/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java
@@ -6,6 +6,7 @@ import java.util.List;
import org.luxons.sevenwonders.game.Player;
import org.luxons.sevenwonders.game.Settings;
+import org.luxons.sevenwonders.game.api.CustomizableSettings;
import org.luxons.sevenwonders.game.api.Table;
import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.boards.Science;
@@ -48,7 +49,7 @@ public class TestUtils {
}
public static Board createBoard(ResourceType initialResource) {
- Settings settings = new Settings();
+ Settings settings = new Settings(5);
Wonder wonder = createWonder(initialResource);
String userName = "testUser" + initialResource.getSymbol();
diff --git a/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java b/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java
new file mode 100644
index 00000000..a8a7643c
--- /dev/null
+++ b/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java
@@ -0,0 +1,5 @@
+package org.luxons.sevenwonders.repositories;
+
+public class PlayerRepositoryTest {
+
+} \ No newline at end of file
bgstack15