summaryrefslogtreecommitdiff
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
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
-rw-r--r--backend/build.gradle17
-rw-r--r--backend/config/checkstyle/checkstyle.xml113
-rw-r--r--backend/src/main/java/org/luxons/sevenwonders/game/Settings.java4
-rw-r--r--backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java8
-rw-r--r--backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java8
-rw-r--r--backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java8
-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
21 files changed, 76 insertions, 181 deletions
diff --git a/backend/build.gradle b/backend/build.gradle
index e4055aa5..c8bdf83f 100644
--- a/backend/build.gradle
+++ b/backend/build.gradle
@@ -15,22 +15,31 @@ repositories {
mavenCentral()
}
+configurations {
+ checkstyleConfig
+}
+
+dependencies {
+}
+
dependencies {
+ compile 'org.springframework.boot:spring-boot-starter-websocket'
+ compile 'org.springframework.security:spring-security-core:4.2.0.RELEASE'
compile 'com.google.code.gson:gson:2.8.0'
compile 'ch.qos.logback:logback-classic:1.1.8'
compile 'org.hildan.livedoc:livedoc-springboot:2.0.0'
compile 'org.hildan.livedoc:livedoc-ui-webjar:2.0.0'
- compile 'org.springframework.boot:spring-boot-starter-websocket'
- compile 'org.springframework.security:spring-security-core:4.2.0.RELEASE'
-
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.hildan.jackstomp:jackstomp:1.1.0'
+
+ checkstyleConfig "org.hildan.checkstyle:checkstyle-config:2.1.0"
}
checkstyle {
maxWarnings = 0
- toolVersion = '7.7'
+ toolVersion = '8.2'
+ config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, "checkstyle.xml")
}
// packages the frontend app within the jar
diff --git a/backend/config/checkstyle/checkstyle.xml b/backend/config/checkstyle/checkstyle.xml
deleted file mode 100644
index b3a6c544..00000000
--- a/backend/config/checkstyle/checkstyle.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
- <property name="severity" value="warning"/>
-
- <module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- </module>
- <module name="NewlineAtEndOfFile"/>
-
- <module name="TreeWalker">
- <property name="tabWidth" value="4"/>
- <module name="Indentation">
- <property name="caseIndent" value="0"/>
- <property name="basicOffset" value="4"/>
- <property name="braceAdjustment" value="0"/>
- <property name="arrayInitIndent" value="8"/>
- </module>
- <module name="LineLength">
- <property name="max" value="121"/>
- <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
- </module>
- <module name="ArrayTypeStyle"/>
- <module name="CovariantEquals"/>
- <module name="AvoidStarImport">
- <property name="allowClassImports" value="false"/>
- <property name="allowStaticMemberImports" value="false"/>
- <property name="excludes" value="java.io,java.net,java.lang.Math,javafx.scene.control"/>
- </module>
- <module name="UnusedImports"/>
- <module name="ClassTypeParameterName">
- <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
- </module>
- <module name="EmptyBlock">
- <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
- <property name="option" value="TEXT"/>
- </module>
- <module name="FallThrough"/>
- <module name="GenericWhitespace"/>
-
- <module name="NoFinalizer"/>
- <module name="UpperEll"/>
- <module name="IllegalTokenText">
- <property name="message" value="Avoid using corresponding octal or Unicode escape."/>
- <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
- <property name="format"
- value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
- </module>
- <module name="RedundantModifier"/>
- <module name="ModifierOrder"/>
- <module name="MultipleVariableDeclarations"/>
- <module name="EmptyStatement"/>
- <module name="OneStatementPerLine"/>
- <module name="OperatorWrap">
- <property name="tokens"
- value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
- <property name="option" value="NL"/>
- </module>
- <module name="NeedBraces"/>
- <module name="LeftCurly"/>
- <module name="RightCurly">
- <property name="tokens"
- value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
- <property name="option" value="alone"/>
- </module>
-
- <module name="WhitespaceAround">
- <property name="allowEmptyConstructors" value="true"/>
- <property name="allowEmptyMethods" value="true"/>
- <property name="allowEmptyTypes" value="true"/>
- </module>
- <module name="NoWhitespaceBefore">
- <property name="tokens" value="COMMA, SEMI, POST_INC, POST_DEC"/>
- </module>
- <module name="MethodParamPad"/>
-
-
- <module name="PackageName">
- <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
- </module>
- <module name="OuterTypeFilename"/>
- <module name="TypeName"/>
- <module name="MemberName">
- <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
- </module>
- <module name="MethodName">
- <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
- </module>
- <module name="ParameterName">
- <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
- </module>
- <module name="MethodTypeParameterName">
- <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
- </module>
- <module name="LocalVariableName">
- <property name="tokens" value="VARIABLE_DEF"/>
- <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
- </module>
-
- <module name="JavadocMethod">
- <property name="scope" value="public"/>
- <property name="allowedAnnotations" value="Override,FXML"/>
- <property name="allowThrowsTagsForSubclasses" value="true"/>
- <property name="allowMissingParamTags" value="false"/>
- <property name="allowMissingReturnTag" value="true"/>
- <property name="allowMissingThrowsTags" value="false"/>
- <property name="allowMissingJavadoc" value="true"/>
- <property name="ignoreMethodNamesRegex" value=".*Property"/>
- </module>
- </module>
-</module>
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java b/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java
index 7d292594..f05b0b01 100644
--- a/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java
+++ b/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java
@@ -78,7 +78,9 @@ public class Settings {
}
public WonderSide pickWonderSide() {
- return lastPickedSide = wonderSidePickMethod.pickSide(getRandom(), lastPickedSide);
+ WonderSide newSide = wonderSidePickMethod.pickSide(getRandom(), lastPickedSide);
+ lastPickedSide = newSide;
+ return newSide;
}
public int getLostPointsPerDefeat() {
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java
index 1519e389..4c1215d4 100644
--- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java
+++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java
@@ -8,14 +8,14 @@ public class GoldIncrease extends InstantOwnBoardEffect {
private final int amount;
- public int getAmount() {
- return amount;
- }
-
public GoldIncrease(int amount) {
this.amount = amount;
}
+ public int getAmount() {
+ return amount;
+ }
+
@Override
public void apply(Board board) {
board.addGold(amount);
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java
index 3accdd62..7da112f5 100644
--- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java
+++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java
@@ -8,14 +8,14 @@ public class MilitaryReinforcements extends InstantOwnBoardEffect {
private final int count;
- public int getCount() {
- return count;
- }
-
public MilitaryReinforcements(int count) {
this.count = count;
}
+ public int getCount() {
+ return count;
+ }
+
@Override
public void apply(Board board) {
board.getMilitary().addShields(count);
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java
index fce8fa3e..9a5d66ed 100644
--- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java
+++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java
@@ -8,14 +8,14 @@ public class RawPointsIncrease extends EndGameEffect {
private final int points;
- public int getPoints() {
- return points;
- }
-
public RawPointsIncrease(int points) {
this.points = points;
}
+ public int getPoints() {
+ return points;
+ }
+
@Override
public int computePoints(Table table, int playerIndex) {
return points;
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