diff options
author | jbion <joffrey.bion@amadeus.com> | 2017-03-13 20:07:12 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2017-03-13 20:07:12 +0100 |
commit | 24ff7b1dd384fcdb79d5c04131922e5a81332196 (patch) | |
tree | 32f48ff89c1dd5516da1a83aae0e008c8670abc6 | |
parent | Update readme with work in progress status information (diff) | |
download | seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.tar.gz seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.tar.bz2 seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.zip |
Add checkstyle configuration
77 files changed, 338 insertions, 175 deletions
diff --git a/backend/build.gradle b/backend/build.gradle index b8331c28..f1abff02 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -9,6 +9,7 @@ buildscript { apply plugin: 'java' apply plugin: 'idea' +apply plugin: 'checkstyle' apply plugin: 'org.springframework.boot' group 'org.luxons' @@ -35,6 +36,11 @@ dependencies { testCompile 'org.springframework.boot:spring-boot-starter-test' } +checkstyle { + maxWarnings = 0 + toolVersion = '7.6' +} + // packages the frontend app within the jar jar { from('../frontend/build') { diff --git a/backend/config/checkstyle/checkstyle.xml b/backend/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..5722bd78 --- /dev/null +++ b/backend/config/checkstyle/checkstyle.xml @@ -0,0 +1,113 @@ +<?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"/> + <property name="lineWrappingIndentation" 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="allowEmptyMethods" value="true"/> + <property name="allowEmptyConstructors" 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>
\ No newline at end of file diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java index 42a26f37..670e44ff 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java @@ -6,7 +6,7 @@ import javax.validation.constraints.Size; public class ChooseNameAction { @NotNull - @Size(min=2, max=20) + @Size(min = 2, max = 20) private String playerName; public String getPlayerName() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java index ce1783c0..00a43971 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java @@ -6,7 +6,7 @@ import javax.validation.constraints.Size; public class CreateGameAction { @NotNull - @Size(min=2, max=30) + @Size(min = 2, max = 30) private String gameName; public String getGameName() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java b/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java index d54d8da4..7ac53250 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java +++ b/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java @@ -48,4 +48,4 @@ public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { public void configureClientInboundChannel(ChannelRegistration registration) { registration.setInterceptors(topicSubscriptionInterceptor); } -}
\ No newline at end of file +} diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java index 8d00994c..46e4531e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java +++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java @@ -35,8 +35,8 @@ public class GameBrowserController { private final SimpMessagingTemplate template; @Autowired - public GameBrowserController(LobbyController lobbyController, LobbyRepository lobbyRepository, PlayerRepository playerRepository, - SimpMessagingTemplate template) { + public GameBrowserController(LobbyController lobbyController, LobbyRepository lobbyRepository, + PlayerRepository playerRepository, SimpMessagingTemplate template) { this.lobbyController = lobbyController; this.lobbyRepository = lobbyRepository; this.playerRepository = playerRepository; diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java index 390d3e83..7b03a976 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java +++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java @@ -4,11 +4,11 @@ import java.security.Principal; import org.luxons.sevenwonders.actions.PrepareCardAction; import org.luxons.sevenwonders.game.Game; +import org.luxons.sevenwonders.game.api.PlayerTurnInfo; +import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.api.PlayerTurnInfo; import org.luxons.sevenwonders.output.PreparedCard; -import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.repositories.PlayerRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java b/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java index 1cd18d09..16a40046 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java @@ -1,5 +1,8 @@ package org.luxons.sevenwonders.errors; enum ErrorType { - USER_INPUT, VALIDATION, CLIENT, SERVER + USER_INPUT, + VALIDATION, + CLIENT, + SERVER } diff --git a/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java b/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java index ee5fcbe0..fbc1ee1d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java +++ b/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java @@ -46,7 +46,7 @@ public class UIError { private UIErrorDetail convertError(ObjectError objectError) { if (objectError instanceof FieldError) { - return new UIErrorDetail((FieldError)objectError); + return new UIErrorDetail((FieldError) objectError); } else { return new UIErrorDetail(objectError); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java index 28b64fbb..179656cb 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java @@ -2,7 +2,6 @@ package org.luxons.sevenwonders.game.api; import java.util.ArrayList; import java.util.List; - import javax.validation.constraints.NotNull; import org.luxons.sevenwonders.game.moves.MoveType; @@ -44,6 +43,6 @@ public class PlayerMove { @Override public String toString() { - return type + " '" + cardName + '\''; + return type + " '" + cardName + '\''; } } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java b/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java index 16f5cf5a..a59bbfae 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java @@ -157,10 +157,10 @@ public class Board { private int computePointsForCards(Table table, Color color) { return playedCards.stream() - .filter(c -> c.getColor() == color) - .flatMap(c -> c.getEffects().stream()) - .mapToInt(e -> e.computePoints(table, playerIndex)) - .sum(); + .filter(c -> c.getColor() == color) + .flatMap(c -> c.getEffects().stream()) + .mapToInt(e -> e.computePoints(table, playerIndex)) + .sum(); } private int computeGoldPoints() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java b/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java index 06408b9e..f1b14c6d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java @@ -1,5 +1,7 @@ package org.luxons.sevenwonders.game.boards; public enum ScienceType { - COMPASS, WHEEL, TABLET + COMPASS, + WHEEL, + TABLET } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java index de674011..473a1bcf 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java @@ -105,7 +105,7 @@ public class Card { if (o == null || getClass() != o.getClass()) { return false; } - Card card = (Card)o; + Card card = (Card) o; return Objects.equals(name, card.name); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java index 5b4e4473..80d06c55 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java @@ -1,5 +1,11 @@ package org.luxons.sevenwonders.game.cards; public enum Color { - BROWN, GREY, YELLOW, BLUE, GREEN, RED, PURPLE + BROWN, + GREY, + YELLOW, + BLUE, + GREEN, + RED, + PURPLE } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java index 9c4f4b02..f3902fb5 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java @@ -1,7 +1,8 @@ package org.luxons.sevenwonders.game.cards; public enum HandRotationDirection { - LEFT(-1), RIGHT(1); + LEFT(-1), + RIGHT(1); private final int indexOffset; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java index f0da6d63..6d464388 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java @@ -71,7 +71,8 @@ public class GameDefinitionLoader { } private static Gson createGson() { - Type resourceTypeList = new TypeToken<List<ResourceType>>() {}.getType(); + Type resourceTypeList = new TypeToken<List<ResourceType>>() { + }.getType(); return new GsonBuilder().disableHtmlEscaping() .registerTypeAdapter(Resources.class, new ResourcesSerializer()) .registerTypeAdapter(ResourceType.class, new ResourceTypeSerializer()) diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java index 08c85f57..34091350 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.game.data.definitions; public enum WonderSide { - A, B + A, + B } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java index 9b2bc2d5..c84bba4e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java @@ -7,7 +7,8 @@ import org.luxons.sevenwonders.game.Settings; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.wonders.WonderStage; -@SuppressWarnings("unused,MismatchedQueryAndUpdateOfCollection") // the fields are injected by Gson +// the fields are injected by Gson +@SuppressWarnings("unused,MismatchedQueryAndUpdateOfCollection") class WonderSideDefinition { private ResourceType initialResource; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java index c1a51f24..c0a75d80 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java @@ -21,11 +21,11 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese public JsonElement serialize(Effect effect, Type typeOfSrc, JsonSerializationContext context) { int value; if (MilitaryReinforcements.class.equals(typeOfSrc)) { - value = ((MilitaryReinforcements)effect).getCount(); + value = ((MilitaryReinforcements) effect).getCount(); } else if (GoldIncrease.class.equals(typeOfSrc)) { - value = ((GoldIncrease)effect).getAmount(); + value = ((GoldIncrease) effect).getAmount(); } else if (RawPointsIncrease.class.equals(typeOfSrc)) { - value = ((RawPointsIncrease)effect).getPoints(); + value = ((RawPointsIncrease) effect).getPoints(); } else { throw new IllegalArgumentException("Unknown numeric effect " + typeOfSrc.getTypeName()); } @@ -33,8 +33,8 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese } @Override - public Effect deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Effect deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { int value = json.getAsInt(); if (MilitaryReinforcements.class.equals(typeOfT)) { return new MilitaryReinforcements(value); @@ -45,4 +45,4 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese } throw new IllegalArgumentException("Unknown numeric effet " + typeOfT.getTypeName()); } -}
\ No newline at end of file +} diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java index b1467900..c3eb1386 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java @@ -13,8 +13,8 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -public class ProductionIncreaseSerializer - implements JsonSerializer<ProductionIncrease>, JsonDeserializer<ProductionIncrease> { +public class ProductionIncreaseSerializer implements JsonSerializer<ProductionIncrease>, + JsonDeserializer<ProductionIncrease> { @Override public JsonElement serialize(ProductionIncrease productionIncrease, Type typeOfSrc, diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java index eead39c3..3fa6b720 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java @@ -39,10 +39,11 @@ public class ProductionSerializer implements JsonSerializer<Production>, JsonDes if (choices.size() > 1) { throw new IllegalArgumentException("Cannot serialize a production with more than one choice"); } - String str = choices.get(0).stream() - .map(ResourceType::getSymbol) - .map(Object::toString) - .collect(Collectors.joining("/")); + String str = choices.get(0) + .stream() + .map(ResourceType::getSymbol) + .map(Object::toString) + .collect(Collectors.joining("/")); return context.serialize(str); } @@ -51,8 +52,8 @@ public class ProductionSerializer implements JsonSerializer<Production>, JsonDes } @Override - public Production deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Production deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String resourcesStr = json.getAsString(); Production production = new Production(); if (resourcesStr.contains("/")) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java index 145063eb..d2a49180 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java @@ -2,6 +2,8 @@ package org.luxons.sevenwonders.game.data.serializers; import java.lang.reflect.Type; +import org.luxons.sevenwonders.game.resources.ResourceType; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -9,7 +11,6 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; public class ResourceTypeSerializer implements JsonSerializer<ResourceType>, JsonDeserializer<ResourceType> { @@ -19,8 +20,8 @@ public class ResourceTypeSerializer implements JsonSerializer<ResourceType>, Jso } @Override - public ResourceType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public ResourceType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String str = json.getAsString(); if (str.isEmpty()) { throw new IllegalArgumentException("Empty string is not a valid resource type"); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java index 8aca5561..89d3e723 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java @@ -5,6 +5,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import org.luxons.sevenwonders.game.resources.ResourceType; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -12,22 +14,19 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; -public class ResourceTypesSerializer implements JsonSerializer<List<ResourceType>>, JsonDeserializer<List<ResourceType>> { +public class ResourceTypesSerializer implements JsonSerializer<List<ResourceType>>, + JsonDeserializer<List<ResourceType>> { @Override public JsonElement serialize(List<ResourceType> resources, Type typeOfSrc, JsonSerializationContext context) { - String s = resources.stream() - .map(ResourceType::getSymbol) - .map(Object::toString) - .collect(Collectors.joining()); + String s = resources.stream().map(ResourceType::getSymbol).map(Object::toString).collect(Collectors.joining()); return new JsonPrimitive(s); } @Override - public List<ResourceType> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public List<ResourceType> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); List<ResourceType> resources = new ArrayList<>(); for (char c : s.toCharArray()) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java index efeafd15..fb6c4e4b 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java @@ -4,6 +4,9 @@ import java.lang.reflect.Type; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.luxons.sevenwonders.game.resources.ResourceType; +import org.luxons.sevenwonders.game.resources.Resources; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -12,8 +15,6 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; -import org.luxons.sevenwonders.game.resources.Resources; public class ResourcesSerializer implements JsonSerializer<Resources>, JsonDeserializer<Resources> { @@ -29,8 +30,8 @@ public class ResourcesSerializer implements JsonSerializer<Resources>, JsonDeser } @Override - public Resources deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Resources deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); Resources resources = new Resources(); for (char c : s.toCharArray()) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java index b6e38540..cecad405 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java @@ -40,8 +40,8 @@ public class ScienceProgressSerializer implements JsonSerializer<ScienceProgress } @Override - public ScienceProgress deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public ScienceProgress deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); ScienceProgress scienceProgress = new ScienceProgress(); Science science = new Science(); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java index 3a44574b..976ebf35 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java @@ -5,8 +5,8 @@ import java.util.List; import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.resources.Provider; -import org.luxons.sevenwonders.game.resources.TradingRules; import org.luxons.sevenwonders.game.resources.ResourceType; +import org.luxons.sevenwonders.game.resources.TradingRules; public class Discount extends InstantOwnBoardEffect { 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 79e7bd1a..1519e389 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 @@ -29,7 +29,7 @@ public class GoldIncrease extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - GoldIncrease that = (GoldIncrease)o; + GoldIncrease that = (GoldIncrease) o; return amount == that.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 b08e2f59..3accdd62 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 @@ -29,7 +29,7 @@ public class MilitaryReinforcements extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - MilitaryReinforcements that = (MilitaryReinforcements)o; + MilitaryReinforcements that = (MilitaryReinforcements) o; return count == that.count; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java index 30bcc625..514c65db 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java @@ -43,7 +43,7 @@ public class ProductionIncrease extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - ProductionIncrease that = (ProductionIncrease)o; + ProductionIncrease that = (ProductionIncrease) o; return Objects.equals(production, that.production); } 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 0d117cec..fce8fa3e 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 @@ -29,7 +29,7 @@ public class RawPointsIncrease extends EndGameEffect { if (o == null || getClass() != o.getClass()) { return false; } - RawPointsIncrease that = (RawPointsIncrease)o; + RawPointsIncrease that = (RawPointsIncrease) o; return points == that.points; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java index 5de87784..cdf67f20 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java @@ -5,6 +5,7 @@ import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.cards.Card; public enum SpecialAbility { + /** * The player can play the last card of each age instead of discarding it. This card can be played by paying its * cost, discarded to gain 3 coins or used in the construction of his or her Wonder. @@ -22,7 +23,7 @@ public enum SpecialAbility { PLAY_DISCARDED, /** - * The player can, at the end of the game, “copy” a Guild of his or her choice (purple card), built by one of his or + * The player can, at the end of the game, "copy" a Guild of his or her choice (purple card), built by one of his or * her two neighboring cities. */ COPY_GUILD { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java index b7701c27..ea824277 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java @@ -79,7 +79,8 @@ public class Production { return false; } - private static Set<ResourceType> findFirstAlternativeContaining(List<Set<ResourceType>> alternatives, ResourceType type) { + private static Set<ResourceType> findFirstAlternativeContaining(List<Set<ResourceType>> alternatives, + ResourceType type) { return alternatives.stream().filter(a -> a.contains(type)).findAny().orElse(null); } @@ -91,7 +92,7 @@ public class Production { if (o == null || getClass() != o.getClass()) { return false; } - Production that = (Production)o; + Production that = (Production) o; return Objects.equals(fixedResources, that.fixedResources) && Objects.equals(alternativeResources, that.alternativeResources); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java index 46d60123..baad8451 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java @@ -13,6 +13,7 @@ public enum ResourceType { LOOM('L'); private static final Map<Character, ResourceType> typesPerSymbol = new HashMap<>(7); + static { for (ResourceType type : values()) { typesPerSymbol.put(type.symbol, type); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java index 5bf6f269..f74ae994 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java @@ -54,7 +54,7 @@ public class Resources { if (o == null || getClass() != o.getClass()) { return false; } - Resources resources = (Resources)o; + Resources resources = (Resources) o; return Objects.equals(quantities, resources.quantities); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java index 26b5f8ba..e7cdaedd 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java @@ -6,7 +6,7 @@ import java.util.PriorityQueue; public class ScoreBoard { private static final Comparator<PlayerScore> comparator = Comparator.comparing(PlayerScore::getTotalPoints) - .thenComparing(PlayerScore::getBoardGold); + .thenComparing(PlayerScore::getBoardGold); private PriorityQueue<PlayerScore> scores; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java index 54976072..a6a9537d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java @@ -1,5 +1,11 @@ package org.luxons.sevenwonders.game.scoring; public enum ScoreCategory { - CIVIL, SCIENCE, MILITARY, TRADE, GUILD, WONDER, GOLD + CIVIL, + SCIENCE, + MILITARY, + TRADE, + GUILD, + WONDER, + GOLD } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java index 3ddddd30..73fff305 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java @@ -52,7 +52,7 @@ public class Wonder { } public int getNbBuiltStages() { - return (int)stages.stream().filter(WonderStage::isBuilt).count(); + return (int) stages.stream().filter(WonderStage::isBuilt).count(); } public String getImage() { @@ -94,9 +94,9 @@ public class Wonder { public int computePoints(Table table, int playerIndex) { return stages.stream() - .filter(WonderStage::isBuilt) - .flatMap(c -> c.getEffects().stream()) - .mapToInt(e -> e.computePoints(table, playerIndex)) - .sum(); + .filter(WonderStage::isBuilt) + .flatMap(c -> c.getEffects().stream()) + .mapToInt(e -> e.computePoints(table, playerIndex)) + .sum(); } } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java index 64d506fc..fc3fc573 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java @@ -2,11 +2,11 @@ package org.luxons.sevenwonders.game.wonders; import java.util.List; -import org.luxons.sevenwonders.game.resources.BoughtResources; import org.luxons.sevenwonders.game.api.Table; import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.game.cards.Requirements; import org.luxons.sevenwonders.game.effects.Effect; +import org.luxons.sevenwonders.game.resources.BoughtResources; public class WonderStage { diff --git a/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java b/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java index 6698c476..c0ac6282 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java +++ b/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.lobby; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.luxons.sevenwonders.game.Game; +import com.fasterxml.jackson.annotation.JsonIgnore; + public class Player { private final String username; diff --git a/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java b/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java index ac696890..5a122274 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java +++ b/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.output; -import org.luxons.sevenwonders.lobby.Player; import org.luxons.sevenwonders.game.cards.CardBack; +import org.luxons.sevenwonders.lobby.Player; public class PreparedCard { diff --git a/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java b/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java index 0a7b9238..eb573479 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java +++ b/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java @@ -4,9 +4,9 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/api/TableTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/api/TableTest.java index 9ed0af02..71dbeb89 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/api/TableTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/api/TableTest.java @@ -46,4 +46,4 @@ public class TableTest { assertEquals(table.getBoard(1), table.getBoard(1, RelativeBoardPosition.SELF)); assertEquals(table.getBoard(2), table.getBoard(1, RelativeBoardPosition.RIGHT)); } -}
\ No newline at end of file +} 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 1dbe7dc7..451f8bb9 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 @@ -20,14 +20,14 @@ import org.luxons.sevenwonders.game.test.TestUtils; import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assume.*; +import static org.junit.Assume.assumeTrue; @RunWith(Theories.class) public class BoardTest { @DataPoints("gold") public static int[] goldAmounts() { - return new int[]{-3, -1, 0, 1, 2, 3}; + return new int[] {-3, -1, 0, 1, 2, 3}; } @DataPoints("nbCards") @@ -105,4 +105,4 @@ public class BoardTest { TestUtils.addCards(board, nbOtherCards, TestUtils.getDifferentColorFrom(color1, color2)); assertEquals(nbCards1 + nbCards2, board.getNbCardsOfColor(Arrays.asList(color1, color2))); } -}
\ No newline at end of file +} 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 16073e91..ccea0f15 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 @@ -37,8 +37,8 @@ public class MilitaryTest { } @Theory - public void victory_addsCorrectPoints(@FromDataPoints("ages") int age, @FromDataPoints("points") int - nbPointsPerVictory) { + public void victory_addsCorrectPoints(@FromDataPoints("ages") int age, + @FromDataPoints("points") int nbPointsPerVictory) { Military military = createMilitary(age, nbPointsPerVictory, 0); int initialPoints = military.getTotalPoints(); @@ -61,4 +61,4 @@ public class MilitaryTest { military.defeat(); assertEquals(initialPoints - nbPointsLostPerDefeat, military.getTotalPoints()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.java index e95a1e37..9f60e572 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.java @@ -5,8 +5,8 @@ import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -import static org.junit.Assert.*; -import static org.junit.Assume.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; @RunWith(Theories.class) public class RelativeBoardPositionTest { @@ -41,4 +41,4 @@ public class RelativeBoardPositionTest { assertEquals(1, RelativeBoardPosition.SELF.getIndexFrom(1, nbPlayers)); assertEquals(2, RelativeBoardPosition.RIGHT.getIndexFrom(1, nbPlayers)); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/boards/ScienceTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/boards/ScienceTest.java index 067a7eff..24c63b31 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/boards/ScienceTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/boards/ScienceTest.java @@ -15,21 +15,9 @@ public class ScienceTest { @DataPoints public static int[][] quantitiesWithExpectedPoints() { // compasses, wheels, tablets, jokers, expected points - return new int[][]{ - {0, 0, 0, 1, 1}, - {0, 0, 1, 0, 1}, - {0, 0, 0, 2, 4}, - {0, 0, 1, 1, 4}, - {0, 0, 2, 0, 4}, - {0, 0, 0, 3, 10}, - {0, 0, 1, 2, 10}, - {0, 1, 1, 1, 10}, - {1, 1, 1, 0, 10}, - {0, 0, 0, 4, 16}, - {0, 0, 1, 3, 16}, - {0, 0, 2, 2, 16}, - {0, 0, 3, 1, 16}, - {0, 0, 4, 0, 16}}; + return new int[][] {{0, 0, 0, 1, 1}, {0, 0, 1, 0, 1}, {0, 0, 0, 2, 4}, {0, 0, 1, 1, 4}, {0, 0, 2, 0, 4}, + {0, 0, 0, 3, 10}, {0, 0, 1, 2, 10}, {0, 1, 1, 1, 10}, {1, 1, 1, 0, 10}, {0, 0, 0, 4, 16}, + {0, 0, 1, 3, 16}, {0, 0, 2, 2, 16}, {0, 0, 3, 1, 16}, {0, 0, 4, 0, 16}}; } @DataPoints @@ -110,4 +98,4 @@ public class ScienceTest { Science science = TestUtils.createScience(expectation[0], expectation[1], expectation[2], expectation[3]); assertEquals(expectation[4], science.computePoints()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardBackTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardBackTest.java index d105c33f..a4f8b95b 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardBackTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardBackTest.java @@ -12,4 +12,4 @@ public class CardBackTest { CardBack back = new CardBack(imagePath); assertEquals(imagePath, back.getImage()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java index 0d40bc9a..437c5f21 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/CardTest.java @@ -14,8 +14,11 @@ import org.luxons.sevenwonders.game.effects.ProductionIncrease; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.wonders.Wonder; -import static org.junit.Assert.*; -import static org.luxons.sevenwonders.game.test.TestUtils.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.luxons.sevenwonders.game.test.TestUtils.createCard; public class CardTest { 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 06060f16..934fcaf1 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 @@ -14,8 +14,10 @@ import org.junit.runner.RunWith; import org.luxons.sevenwonders.game.cards.Decks.CardNotFoundException; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; -import static org.junit.Assume.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; @RunWith(Theories.class) public class DecksTest { @@ -107,4 +109,4 @@ public class DecksTest { assertEquals(nbCardsPerPlayer, hands.get(i).size()); } } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.java index 6165d158..d027464a 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.java @@ -12,4 +12,4 @@ public class HandRotationDirectionTest { assertEquals(HandRotationDirection.RIGHT, HandRotationDirection.forAge(2)); assertEquals(HandRotationDirection.LEFT, HandRotationDirection.forAge(3)); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandsTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandsTest.java index 494b9e4c..c20508e6 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandsTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/HandsTest.java @@ -15,8 +15,10 @@ import org.luxons.sevenwonders.game.api.Table; import org.luxons.sevenwonders.game.cards.Hands.PlayerIndexOutOfBoundsException; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; -import static org.junit.Assume.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; @RunWith(Theories.class) public class HandsTest { @@ -138,4 +140,4 @@ public class HandsTest { assertTrue(hand0.contains(handCard.getCard())); } } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java index d851ae30..a6e5151d 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java @@ -60,7 +60,8 @@ public class RequirementsTest { } @Theory - public void resourceRequirement_ownProduction(ResourceType initialResource, ResourceType producedResource, ResourceType requiredResource) { + public void resourceRequirement_ownProduction(ResourceType initialResource, ResourceType producedResource, + ResourceType requiredResource) { assumeTrue(initialResource != requiredResource); Resources resources = TestUtils.createResources(requiredResource); @@ -72,11 +73,12 @@ public class RequirementsTest { Table table = new Table(Collections.singletonList(board)); assertEquals(producedResource == requiredResource, requirements.isAffordedBy(board)); - assertEquals(producedResource == requiredResource, requirements.isAffordedBy(table, 0, Collections.emptyList())); + assertEquals(producedResource == requiredResource, + requirements.isAffordedBy(table, 0, Collections.emptyList())); if (producedResource == requiredResource) { assertTrue(requirements.couldBeAffordedBy(table, 0)); } } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionLoaderTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionLoaderTest.java index b38afd49..36a42c61 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionLoaderTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionLoaderTest.java @@ -2,7 +2,7 @@ package org.luxons.sevenwonders.game.data; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; public class GameDefinitionLoaderTest { @@ -13,4 +13,4 @@ public class GameDefinitionLoaderTest { assertNotNull(gameDefinition); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java index a5b37edd..f29b33d9 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/data/GameDefinitionTest.java @@ -16,4 +16,4 @@ public class GameDefinitionTest { Game game = gameDefinition.initGame(0, new CustomizableSettings(), 7); assertNotNull(game); } -}
\ No newline at end of file +} 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 2544ca64..b75c9f42 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 @@ -93,4 +93,4 @@ public class WonderSidePickMethodTest { assertEquals(WonderSide.A, WonderSidePickMethod.SAME_RANDOM_FOR_ALL.pickSide(random, null)); assertEquals(WonderSide.B, WonderSidePickMethod.SAME_RANDOM_FOR_ALL.pickSide(random2, null)); } -}
\ No newline at end of file +} 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 753a26cf..196e2128 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 @@ -13,7 +13,7 @@ import org.luxons.sevenwonders.game.effects.RawPointsIncrease; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; @RunWith(Theories.class) public class NumericEffectSerializerTest { @@ -125,4 +125,4 @@ public class NumericEffectSerializerTest { public void deserialize_failOnUnknownType() { gson.fromJson("\"2\"", ProductionIncrease.class); } -}
\ No newline at end of file +} 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 f4b41628..faa1b430 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 @@ -13,7 +13,8 @@ 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.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class ProductionIncreaseSerializerTest { @@ -185,4 +186,4 @@ public class ProductionIncreaseSerializerTest { public void deserialize_failOnMultipleResourcesInChoice() { gson.fromJson("\"W/SS/C\"", ProductionIncrease.class); } -}
\ No newline at end of file +} 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 34a06ce4..4516c2ec 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 @@ -12,7 +12,8 @@ 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.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class ProductionSerializerTest { @@ -20,12 +21,13 @@ public class ProductionSerializerTest { @Before public void setUp() { - Type resourceTypeList = new TypeToken<List<ResourceType>>() {}.getType(); + Type resourceTypeList = new TypeToken<List<ResourceType>>() { + }.getType(); gson = new GsonBuilder().registerTypeAdapter(Resources.class, new ResourcesSerializer()) - .registerTypeAdapter(ResourceType.class, new ResourceTypeSerializer()) - .registerTypeAdapter(resourceTypeList, new ResourceTypesSerializer()) - .registerTypeAdapter(Production.class, new ProductionSerializer()) - .create(); + .registerTypeAdapter(ResourceType.class, new ResourceTypeSerializer()) + .registerTypeAdapter(resourceTypeList, new ResourceTypesSerializer()) + .registerTypeAdapter(Production.class, new ProductionSerializer()) + .create(); } private static Production create(int wood, int stone, int clay) { @@ -195,4 +197,4 @@ public class ProductionSerializerTest { gson.fromJson("\"W/SS/C\"", Production.class); } -}
\ No newline at end of file +} 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 86f3f5ab..5ff544b0 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 @@ -6,7 +6,8 @@ import org.luxons.sevenwonders.game.resources.ResourceType; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class ResourceTypeSerializerTest { @@ -20,7 +21,7 @@ public class ResourceTypeSerializerTest { @Test public void serialize_useSymbolForEachType() { for (ResourceType type : ResourceType.values()) { - String expectedJson = "\"" + type.getSymbol() + "\""; + String expectedJson = "\"" + type.getSymbol() + "\""; assertEquals(expectedJson, gson.toJson(type)); } } @@ -28,7 +29,7 @@ public class ResourceTypeSerializerTest { @Test public void deserialize_useSymbolForEachType() { for (ResourceType type : ResourceType.values()) { - String typeInJson = "\"" + type.getSymbol() + "\""; + String typeInJson = "\"" + type.getSymbol() + "\""; assertEquals(type, gson.fromJson(typeInJson, ResourceType.class)); } } @@ -47,4 +48,4 @@ public class ResourceTypeSerializerTest { public void deserialize_failsOnGarbageString() { gson.fromJson("\"thisisgarbage\"", ResourceType.class); } -}
\ No newline at end of file +} 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 4ebbc33f..c2972c60 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 @@ -11,7 +11,8 @@ 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.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class ResourceTypesSerializerTest { @@ -23,7 +24,8 @@ public class ResourceTypesSerializerTest { } private static Type createListTypeToken() { - return new TypeToken<List<ResourceType>>() {}.getType(); + return new TypeToken<List<ResourceType>>() { + }.getType(); } @Test @@ -97,4 +99,4 @@ public class ResourceTypesSerializerTest { types.add(ResourceType.STONE); assertEquals(types, gson.fromJson("\"WCS\"", createListTypeToken())); } -}
\ No newline at end of file +} 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 1fd01337..884e1425 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 @@ -7,7 +7,8 @@ import org.luxons.sevenwonders.game.resources.Resources; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class ResourcesSerializerTest { @@ -104,4 +105,4 @@ public class ResourcesSerializerTest { resources.add(ResourceType.STONE, 3); assertEquals(resources, gson.fromJson("\"SCWCSS\"", Resources.class)); } -}
\ No newline at end of file +} 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 40088fda..34e1f5ed 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 @@ -8,7 +8,8 @@ import org.luxons.sevenwonders.game.test.TestUtils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; public class ScienceProgressSerializerTest { @@ -142,4 +143,4 @@ public class ScienceProgressSerializerTest { assertEquals(1, progress.getScience().getJokers()); } -}
\ No newline at end of file +} 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 5f42bc53..a783ba5a 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 @@ -16,7 +16,7 @@ import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.game.cards.Color; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; @RunWith(Theories.class) public class BonusPerBoardElementTest { @@ -65,7 +65,8 @@ public class BonusPerBoardElementTest { } @Theory - public void computePoints_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points, int gold) { + public void computePoints_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points, + int gold) { Board board = table.getBoard(0, boardPosition); for (int i = 0; i < nbDefeatTokens; i++) { board.getMilitary().defeat(); @@ -78,7 +79,8 @@ public class BonusPerBoardElementTest { } @Theory - public void computePoints_countsWonderStages(RelativeBoardPosition boardPosition, int nbStages, int points, int gold) { + public void computePoints_countsWonderStages(RelativeBoardPosition boardPosition, int nbStages, int points, + int gold) { Board board = table.getBoard(0, boardPosition); for (int i = 0; i < nbStages; i++) { board.getWonder().buildLevel(new CardBack("")); @@ -91,8 +93,8 @@ public class BonusPerBoardElementTest { } @Theory - public void apply_countsCards(RelativeBoardPosition boardPosition, int nbCards, int nbOtherCards, - int points, int gold, Color color) { + public void apply_countsCards(RelativeBoardPosition boardPosition, int nbCards, int nbOtherCards, int points, + int gold, Color color) { Board board = table.getBoard(0, boardPosition); TestUtils.addCards(board, nbCards, nbOtherCards, color); @@ -106,7 +108,8 @@ public class BonusPerBoardElementTest { } @Theory - public void apply_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points, int gold) { + public void apply_countsDefeatTokens(RelativeBoardPosition boardPosition, int nbDefeatTokens, int points, + int gold) { Board board = table.getBoard(0, boardPosition); for (int i = 0; i < nbDefeatTokens; i++) { board.getMilitary().defeat(); @@ -136,4 +139,4 @@ public class BonusPerBoardElementTest { bonus.apply(table, 0); assertEquals(initialGold + nbStages * gold, selfBoard.getGold()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/DiscountTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/DiscountTest.java index cf8ce21d..c6819d3a 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/DiscountTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/DiscountTest.java @@ -18,7 +18,7 @@ public class DiscountTest { @DataPoints public static int[] discountedPrices() { - return new int[]{0, 1, 2}; + return new int[] {0, 1, 2}; } @DataPoints @@ -46,7 +46,7 @@ public class DiscountTest { @Theory public void apply_doesNotAffectOtherResources(int discountedPrice, ResourceType discountedType, Provider provider, - ResourceType otherType, Provider otherProvider) { + ResourceType otherType, Provider otherProvider) { Assume.assumeTrue(otherProvider != provider); Assume.assumeTrue(otherType != discountedType); @@ -69,4 +69,4 @@ public class DiscountTest { BoughtResources fromOtherProviderAndType = TestUtils.createBoughtResources(otherProvider, otherType); assertEquals(normalPrice, board.getTradingRules().computeCost(fromOtherProviderAndType)); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.java index e4d4c27f..be124251 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.java @@ -9,14 +9,16 @@ import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @RunWith(Theories.class) public class GoldIncreaseTest { @DataPoints public static int[] goldAmounts() { - return new int[]{-5, -1, 0, 1, 2, 5, 10}; + return new int[] {-5, -1, 0, 1, 2, 5, 10}; } @DataPoints @@ -75,4 +77,4 @@ public class GoldIncreaseTest { GoldIncrease goldIncrease2 = new GoldIncrease(gold); assertEquals(goldIncrease1.hashCode(), goldIncrease2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.java index d3c2cc03..478af746 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.java @@ -9,14 +9,16 @@ import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @RunWith(Theories.class) public class MilitaryReinforcementsTest { @DataPoints public static int[] shieldCounts() { - return new int[]{0, 1, 2, 3, 5}; + return new int[] {0, 1, 2, 3, 5}; } @DataPoints @@ -76,4 +78,4 @@ public class MilitaryReinforcementsTest { MilitaryReinforcements reinforcements2 = new MilitaryReinforcements(shields); assertEquals(reinforcements1.hashCode(), reinforcements2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.java index d19f6288..b6a47292 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.java @@ -11,7 +11,9 @@ import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.resources.Resources; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @RunWith(Theories.class) public class ProductionIncreaseTest { @@ -104,4 +106,4 @@ public class ProductionIncreaseTest { ProductionIncrease effect2 = createProductionIncrease(addedType); assertEquals(effect1.hashCode(), effect2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java index a1c8a8de..020eda73 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java @@ -7,7 +7,9 @@ import org.junit.runner.RunWith; import org.luxons.sevenwonders.game.api.Table; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @RunWith(Theories.class) public class RawPointsIncreaseTest { @@ -58,4 +60,4 @@ public class RawPointsIncreaseTest { RawPointsIncrease rawPointsIncrease2 = new RawPointsIncrease(points); assertEquals(rawPointsIncrease1.hashCode(), rawPointsIncrease2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/ScienceProgressTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/ScienceProgressTest.java index 56289654..b5402a7e 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/ScienceProgressTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/ScienceProgressTest.java @@ -10,7 +10,7 @@ import org.luxons.sevenwonders.game.boards.ScienceType; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; @RunWith(Theories.class) public class ScienceProgressTest { @@ -35,4 +35,4 @@ public class ScienceProgressTest { assertEquals(initTablets + tablets, board.getScience().getQuantity(ScienceType.TABLET)); assertEquals(initJokers + jokers, board.getScience().getJokers()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.java index b04db127..0f30a3a5 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.java @@ -29,7 +29,7 @@ public class SpecialAbilityActivationTest { @DataPoints public static RelativeBoardPosition[] neighbours() { - return new RelativeBoardPosition[]{RelativeBoardPosition.LEFT, RelativeBoardPosition.RIGHT}; + return new RelativeBoardPosition[] {RelativeBoardPosition.LEFT, RelativeBoardPosition.RIGHT}; } @DataPoints @@ -46,7 +46,7 @@ public class SpecialAbilityActivationTest { Arrays.asList(RelativeBoardPosition.LEFT, RelativeBoardPosition.SELF, RelativeBoardPosition.RIGHT)); bonus2.setPoints(1); - return new Card[]{TestUtils.createGuildCard(1, bonus), TestUtils.createGuildCard(2, bonus2)}; + return new Card[] {TestUtils.createGuildCard(1, bonus), TestUtils.createGuildCard(2, bonus2)}; } @Theory @@ -91,4 +91,4 @@ public class SpecialAbilityActivationTest { Table table = TestUtils.createTable(5); effect.computePoints(table, 0); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/resources/ProductionTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/resources/ProductionTest.java index 76d2345f..c54209c1 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/resources/ProductionTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/resources/ProductionTest.java @@ -3,7 +3,9 @@ package org.luxons.sevenwonders.game.resources; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class ProductionTest { @@ -268,4 +270,4 @@ public class ProductionTest { production2.addChoice(ResourceType.ORE, ResourceType.WOOD); assertEquals(production1.hashCode(), production2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/resources/ResourcesTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/resources/ResourcesTest.java index 674c90e7..cd352c8b 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/resources/ResourcesTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/resources/ResourcesTest.java @@ -428,4 +428,4 @@ public class ResourcesTest { resources2.add(ResourceType.GLASS, 1); assertEquals(resources1.hashCode(), resources2.hashCode()); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/resources/TradingRulesTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/resources/TradingRulesTest.java index cd6661dc..00400e7c 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/game/resources/TradingRulesTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/game/resources/TradingRulesTest.java @@ -10,8 +10,8 @@ import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; import org.luxons.sevenwonders.game.test.TestUtils; -import static org.junit.Assert.*; -import static org.junit.Assume.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; @RunWith(Theories.class) public class TradingRulesTest { @@ -93,4 +93,4 @@ public class TradingRulesTest { assertEquals(defaultCost + overriddenCost, rules.computeCost(boughtResources)); } -}
\ No newline at end of file +} 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 adc37d3d..c47e30b4 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/lobby/LobbyTest.java @@ -178,4 +178,4 @@ public class LobbyTest { lobby.startGame(); assertTrue(lobby.getState() == State.PLAYING); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.java b/backend/src/test/java/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.java index 35618d49..4ba7d6e3 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.java @@ -2,9 +2,9 @@ package org.luxons.sevenwonders.repositories; import org.junit.Before; import org.junit.Test; +import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.repositories.LobbyRepository.LobbyNotFoundException; import static org.junit.Assert.assertNotNull; @@ -74,4 +74,4 @@ public class LobbyRepositoryTest { // the lobby has been properly removed } } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java b/backend/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java index 8a6efe8c..95fd80fd 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.java @@ -70,4 +70,4 @@ public class PlayerRepositoryTest { repository.remove("player1"); assertFalse(repository.contains("player1")); } -}
\ No newline at end of file +} diff --git a/backend/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java b/backend/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java index 8623ead8..bdf6c8c9 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/validation/DestinationAccessValidatorTest.java @@ -2,9 +2,9 @@ package org.luxons.sevenwonders.validation; import org.junit.Before; import org.junit.Test; +import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.repositories.LobbyRepository; import org.luxons.sevenwonders.repositories.LobbyRepository.LobbyNotFoundException; @@ -138,4 +138,4 @@ public class DestinationAccessValidatorTest { assertTrue(destinationAccessValidator.hasAccess("user6", "/game/1")); } -}
\ No newline at end of file +} |