summaryrefslogtreecommitdiff
path: root/backend/src/test/java/org/luxons
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-09-29 01:18:23 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-09-29 01:18:23 +0200
commiteb35c4ddde39f737a0a5f1067bba4ad92eb5a65f (patch)
tree7b62f88f8378d4bae54afcc2c69c462047c45130 /backend/src/test/java/org/luxons
parentAllow empty types in checkstyle config (diff)
downloadseven-wonders-eb35c4ddde39f737a0a5f1067bba4ad92eb5a65f.tar.gz
seven-wonders-eb35c4ddde39f737a0a5f1067bba4ad92eb5a65f.tar.bz2
seven-wonders-eb35c4ddde39f737a0a5f1067bba4ad92eb5a65f.zip
Move to shared checkstyle config 2.1.0
Diffstat (limited to 'backend/src/test/java/org/luxons')
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java4
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java6
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java6
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java6
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/definitions/WonderSidePickMethodTest.java8
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializerTest.java8
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java6
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.java7
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.java4
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.java6
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.java4
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializerTest.java5
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.java16
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.java1
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java12
15 files changed, 48 insertions, 51 deletions
diff --git a/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java b/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java
index 16b55892..9c060673 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java
@@ -76,7 +76,7 @@ public class SevenWondersTest {
TimeoutException {
SevenWondersSession ownerSession = newPlayer("GameOwner");
SevenWondersSession session1 = newPlayer("Player1");
- SevenWondersSession session2 = newPlayer( "Player2");
+ SevenWondersSession session2 = newPlayer("Player2");
String gameName = "Test Game";
ApiLobby lobby = ownerSession.createGame(gameName);
session1.joinGame(lobby.getId());
@@ -130,7 +130,7 @@ public class SevenWondersTest {
@Test
public void startGame_3players() throws Exception {
SevenWondersSession session1 = newPlayer("Player1");
- SevenWondersSession session2 = newPlayer( "Player2");
+ SevenWondersSession session2 = newPlayer("Player2");
ApiLobby lobby = session1.createGame("Test Game");
session2.joinGame(lobby.getId());
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java
index 90a5e5d2..c54ff0b2 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/boards/BoardTest.java
@@ -36,6 +36,9 @@ import static org.junit.Assume.assumeTrue;
@RunWith(Theories.class)
public class BoardTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@DataPoints("gold")
public static int[] goldAmounts() {
return new int[]{-3, -1, 0, 1, 2, 3};
@@ -61,9 +64,6 @@ public class BoardTest {
return SpecialAbility.values();
}
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Theory
public void initialGold_respectsSettings(@FromDataPoints("gold") int goldAmountInSettings) {
CustomizableSettings customSettings = TestUtils.createCustomizableSettings();
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
index ccea0f15..b391c6b0 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/boards/MilitaryTest.java
@@ -17,6 +17,9 @@ import static org.junit.Assert.assertEquals;
@RunWith(Theories.class)
public class MilitaryTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@DataPoints("points")
public static int[] points() {
return new int[] {0, 1, 3, 5};
@@ -27,9 +30,6 @@ public class MilitaryTest {
return new int[] {1, 2, 3};
}
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private static Military createMilitary(int age, int nbPointsPerVictory, int nbPointsPerDefeat) {
Map<Integer, Integer> wonPointsPerAge = new HashMap<>();
wonPointsPerAge.put(age, nbPointsPerVictory);
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java
index 934fcaf1..8adeb44d 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java
@@ -22,14 +22,14 @@ import static org.junit.Assume.assumeTrue;
@RunWith(Theories.class)
public class DecksTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@DataPoints
public static int[] dataPoints() {
return new int[] {1, 2, 3, 5, 10};
}
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private static Decks createDecks(int nbAges, int nbCardsPerAge) {
Map<Integer, List<Card>> cardsPerAge = new HashMap<>();
for (int age = 1; age <= nbAges; age++) {
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/definitions/WonderSidePickMethodTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/definitions/WonderSidePickMethodTest.java
index b75c9f42..0b7de3d6 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/definitions/WonderSidePickMethodTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/definitions/WonderSidePickMethodTest.java
@@ -14,15 +14,15 @@ import static org.junit.Assert.assertEquals;
@RunWith(Theories.class)
public class WonderSidePickMethodTest {
+ private Random random;
+
+ private Random random2;
+
@DataPoints
public static WonderSide[] sides() {
return WonderSide.values();
}
- private Random random;
-
- private Random random2;
-
@Before
public void setUp() {
random = new Random(123); // starts with TRUE
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializerTest.java
index 196e2128..861d5a09 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializerTest.java
@@ -1,5 +1,7 @@
package org.luxons.sevenwonders.game.data.serializers;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
@@ -11,20 +13,18 @@ import org.luxons.sevenwonders.game.effects.MilitaryReinforcements;
import org.luxons.sevenwonders.game.effects.ProductionIncrease;
import org.luxons.sevenwonders.game.effects.RawPointsIncrease;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import static org.junit.Assert.assertEquals;
@RunWith(Theories.class)
public class NumericEffectSerializerTest {
+ private Gson gson;
+
@DataPoints
public static int[] dataPoints() {
return new int[] {-2, -1, 0, 1, 2, 5};
}
- private Gson gson;
-
@Before
public void setUp() {
gson = new GsonBuilder().registerTypeAdapter(MilitaryReinforcements.class, new NumericEffectSerializer())
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java
index faa1b430..8c5108ba 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.java
@@ -3,6 +3,9 @@ package org.luxons.sevenwonders.game.data.serializers;
import java.lang.reflect.Type;
import java.util.List;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.effects.ProductionIncrease;
@@ -10,9 +13,6 @@ import org.luxons.sevenwonders.game.resources.Production;
import org.luxons.sevenwonders.game.resources.ResourceType;
import org.luxons.sevenwonders.game.resources.Resources;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.java
index 4516c2ec..86ee16e9 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.java
@@ -3,15 +3,15 @@ package org.luxons.sevenwonders.game.data.serializers;
import java.lang.reflect.Type;
import java.util.List;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.resources.Production;
import org.luxons.sevenwonders.game.resources.ResourceType;
import org.luxons.sevenwonders.game.resources.Resources;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -196,5 +196,4 @@ public class ProductionSerializerTest {
public void deserialize_failOnMultipleResourcesInChoice() {
gson.fromJson("\"W/SS/C\"", Production.class);
}
-
}
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.java
index 5ff544b0..3a688f4d 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.java
@@ -1,11 +1,11 @@
package org.luxons.sevenwonders.game.data.serializers;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.resources.ResourceType;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.java
index c2972c60..b5011fa5 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.java
@@ -4,13 +4,13 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.resources.ResourceType;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.java
index 884e1425..e1dc4e2b 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.java
@@ -1,12 +1,12 @@
package org.luxons.sevenwonders.game.data.serializers;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.resources.ResourceType;
import org.luxons.sevenwonders.game.resources.Resources;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializerTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializerTest.java
index 34e1f5ed..0387e198 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializerTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializerTest.java
@@ -1,13 +1,13 @@
package org.luxons.sevenwonders.game.data.serializers;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import org.junit.Before;
import org.junit.Test;
import org.luxons.sevenwonders.game.boards.ScienceType;
import org.luxons.sevenwonders.game.effects.ScienceProgress;
import org.luxons.sevenwonders.game.test.TestUtils;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -142,5 +142,4 @@ public class ScienceProgressSerializerTest {
assertEquals(0, progress.getScience().getQuantity(ScienceType.TABLET));
assertEquals(1, progress.getScience().getJokers());
}
-
}
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.java
index 8c7da876..bacea896 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.java
@@ -21,9 +21,11 @@ import static org.junit.Assert.assertEquals;
@RunWith(Theories.class)
public class BonusPerBoardElementTest {
+ private Table table;
+
@DataPoints
public static int[] values() {
- return new int[] {0, 1, 2, 3};
+ return new int[]{0, 1, 2, 3};
}
@DataPoints
@@ -36,8 +38,6 @@ public class BonusPerBoardElementTest {
return RelativeBoardPosition.values();
}
- private Table table;
-
@Before
public void setUp() {
table = TestUtils.createTable(4);
@@ -54,7 +54,7 @@ public class BonusPerBoardElementTest {
@Theory
public void computePoints_countsCards(RelativeBoardPosition boardPosition, int nbCards, int nbOtherCards,
- int points, int gold, Color color) {
+ int points, int gold, Color color) {
Board board = table.getBoard(0, boardPosition);
TestUtils.addCards(board, nbCards, nbOtherCards, color);
@@ -66,7 +66,7 @@ public class BonusPerBoardElementTest {
@Theory
public void computePoints_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points,
- int gold) {
+ int gold) {
Board board = table.getBoard(0, boardPosition);
for (int i = 0; i < nbDefeatTokens; i++) {
board.getMilitary().defeat();
@@ -80,7 +80,7 @@ public class BonusPerBoardElementTest {
@Theory
public void computePoints_countsWonderStages(RelativeBoardPosition boardPosition, int nbStages, int points,
- int gold) {
+ int gold) {
Board board = table.getBoard(0, boardPosition);
for (int i = 0; i < nbStages; i++) {
board.getWonder().buildLevel(new CardBack(""));
@@ -94,7 +94,7 @@ public class BonusPerBoardElementTest {
@Theory
public void apply_countsCards(RelativeBoardPosition boardPosition, int nbCards, int nbOtherCards, int points,
- int gold, Color color) {
+ int gold, Color color) {
Board board = table.getBoard(0, boardPosition);
TestUtils.addCards(board, nbCards, nbOtherCards, color);
@@ -109,7 +109,7 @@ public class BonusPerBoardElementTest {
@Theory
public void apply_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points,
- int gold) {
+ int gold) {
Board board = table.getBoard(0, boardPosition);
for (int i = 0; i < nbDefeatTokens; i++) {
board.getMilitary().defeat();
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.java
index 3706745d..e6438789 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.java
@@ -86,7 +86,6 @@ public class BestPriceCalculatorTest {
Table table = new Table(Arrays.asList(main, right, left));
-
Resources resources = new Resources();
resources.add(ResourceType.ORE, 1);
resources.add(ResourceType.CLAY, 1);
diff --git a/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java b/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java
index ad59d983..5747eb5a 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java
@@ -32,20 +32,20 @@ import static org.junit.Assume.assumeTrue;
@RunWith(Theories.class)
public class LobbyTest {
- @DataPoints
- public static int[] nbPlayers() {
- return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- }
+ private static GameDefinition gameDefinition;
@Rule
public ExpectedException thrown = ExpectedException.none();
- private static GameDefinition gameDefinition;
-
private Player gameOwner;
private Lobby lobby;
+ @DataPoints
+ public static int[] nbPlayers() {
+ return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ }
+
@BeforeClass
public static void loadDefinition() {
gameDefinition = new GameDefinitionLoader().getGameDefinition();
bgstack15