From 1e98b6bdf6aac5df09545349373a9f9624f38692 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Wed, 1 Aug 2018 00:09:46 +0200 Subject: Remove checkstyle and add ktlint --- game-engine/build.gradle | 18 ++--------------- .../kotlin/org/luxons/sevenwonders/game/Game.kt | 4 ++-- .../kotlin/org/luxons/sevenwonders/game/Player.kt | 2 +- .../org/luxons/sevenwonders/game/api/Action.kt | 3 +-- .../org/luxons/sevenwonders/game/boards/Science.kt | 2 +- .../sevenwonders/game/data/GameDefinitionLoader.kt | 4 ++-- .../game/data/definitions/WonderDefinition.kt | 2 +- .../serializers/ProductionIncreaseSerializer.kt | 2 +- .../sevenwonders/game/resources/Resources.kt | 2 +- .../org/luxons/sevenwonders/game/GameTest.kt | 5 ++++- .../org/luxons/sevenwonders/game/api/TableTest.kt | 4 +++- .../luxons/sevenwonders/game/boards/BoardTest.kt | 5 +++-- .../sevenwonders/game/boards/MilitaryTest.kt | 6 ++---- .../game/boards/RelativeBoardPositionTest.kt | 5 ++--- .../luxons/sevenwonders/game/boards/ScienceTest.kt | 5 ++--- .../luxons/sevenwonders/game/cards/CardBackTest.kt | 3 +-- .../luxons/sevenwonders/game/cards/DecksTest.kt | 4 +++- .../game/cards/HandRotationDirectionTest.kt | 3 +-- .../luxons/sevenwonders/game/cards/HandsTest.kt | 4 +++- .../sevenwonders/game/cards/RequirementsTest.kt | 5 ++++- .../ProductionIncreaseSerializerTest.kt | 4 +--- .../serializers/ResourceTypesSerializerTest.kt | 4 +--- .../data/serializers/ResourcesSerializerTest.kt | 4 +++- .../game/effects/BonusPerBoardElementTest.kt | 23 ++++++++++++++++------ .../sevenwonders/game/effects/DiscountTest.kt | 7 +++++-- .../game/effects/ProductionIncreaseTest.kt | 4 +++- .../game/effects/ScienceProgressTest.kt | 10 ++++++++-- .../game/resources/BestPriceCalculatorTest.kt | 6 +++++- .../sevenwonders/game/resources/ProductionTest.kt | 12 +++++++++-- .../sevenwonders/game/resources/ResourcesTest.kt | 13 ++++++++++-- .../game/resources/TradingRulesTest.kt | 7 +++++-- .../org/luxons/sevenwonders/game/test/TestUtils.kt | 11 ++++++++--- .../luxons/sevenwonders/game/wonders/WonderTest.kt | 7 +++---- 33 files changed, 120 insertions(+), 80 deletions(-) (limited to 'game-engine') diff --git a/game-engine/build.gradle b/game-engine/build.gradle index 97067176..eb706af5 100644 --- a/game-engine/build.gradle +++ b/game-engine/build.gradle @@ -1,30 +1,16 @@ plugins { id "org.jetbrains.kotlin.jvm" version "1.2.51" + id "org.jlleitschuh.gradle.ktlint" version "4.1.0" } -apply plugin: 'checkstyle' - group 'org.luxons' repositories { - mavenCentral() -} - -configurations { - checkstyleConfig - ktlint + jcenter() } dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' implementation 'com.github.salomonbrys.kotson:kotson:2.5.0' testImplementation 'junit:junit:4.12' - checkstyleConfig 'org.hildan.checkstyle:checkstyle-config:2.1.0' - ktlint 'com.github.shyiko:ktlint:0.24.0' -} - -checkstyle { - maxWarnings = 0 - toolVersion = '8.2' - config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, "checkstyle.xml") } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt index 639c5535..d3327ba5 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt @@ -59,8 +59,8 @@ class Game internal constructor( endOfGameReached() && board.hasSpecial(SpecialAbility.COPY_GUILD) -> determineCopyGuildAction(board) hand.size == 1 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD) -> Action.PLAY_LAST hand.size == 2 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD) -> Action.PLAY_2 - hand.isEmpty() -> Action.WAIT - else -> Action.PLAY + hand.isEmpty() -> Action.WAIT + else -> Action.PLAY } private fun determineCopyGuildAction(board: Board): Action { diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt index c9e90f5c..c7d429ec 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt @@ -14,7 +14,7 @@ internal interface Player { internal data class SimplePlayer( override val index: Int, private val table: Table -): Player { +) : Player { override val board = table.getBoard(index) override fun getBoard(relativePosition: RelativeBoardPosition) = table.getBoard(index, relativePosition) } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt index 6cfd3679..a5ffd721 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt @@ -2,8 +2,7 @@ package org.luxons.sevenwonders.game.api enum class Action(val message: String) { PLAY("Pick the card you want to play or discard."), - PLAY_2("Pick the first card you want to play or discard. Note that you have the ability to play these 2 last " - + "cards. You will choose how to play the last one during your next turn."), + PLAY_2("Pick the first card you want to play or discard. Note that you have the ability to play these 2 last cards. You will choose how to play the last one during your next turn."), PLAY_LAST("You have the special ability to play your last card. Choose how you want to play it."), PICK_NEIGHBOR_GUILD("Choose a Guild card (purple) that you want to copy from one of your neighbours."), WAIT("Please wait for other players to perform extra actions.") diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt index 839986e0..cf2b7901 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt @@ -8,7 +8,7 @@ enum class ScienceType { class Science { - private val quantities : MutableMap = mutableMapOf() + private val quantities: MutableMap = mutableMapOf() var jokers: Int = 0 private set diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt index e0f82c2b..fc0f8a71 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt @@ -55,6 +55,6 @@ object GameDefinitionLoader { .create() } - private inline fun GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder - = this.registerTypeAdapter(typeToken(), typeAdapter) + private inline fun GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder = + this.registerTypeAdapter(typeToken(), typeAdapter) } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt index c75e18d4..ece0fe5f 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt @@ -18,7 +18,7 @@ internal class WonderSideDefinition( private val stages: List, private val image: String ) { - fun createWonder(name: String): Wonder = Wonder(name, initialResource, stages.map { it.create() }, image) + fun createWonder(name: String): Wonder = Wonder(name, initialResource, stages.map { it.create() }, image) } internal class WonderStageDefinition( diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt index 6412d6b5..0970a968 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt @@ -20,7 +20,7 @@ internal class ProductionIncreaseSerializer : JsonSerializer ): JsonElement { val production = productionIncrease.production val json = context.serialize(production) - return if (!json.isJsonNull && !productionIncrease.isSellable) { JsonPrimitive("(${json.asString})")} else json + return if (!json.isJsonNull && !productionIncrease.isSellable) { JsonPrimitive("(${json.asString})") } else json } @Throws(JsonParseException::class) diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt index 15673bd2..476ffea8 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt @@ -22,7 +22,7 @@ internal fun mutableResourcesOf(vararg resources: Pair) = fun Iterable.toResources(): Resources = resourcesOf(this) -fun Iterable.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1} +fun Iterable.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1 } internal fun Resources.toMutableResources(): MutableResources { val resources = MutableResources() diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt index 135f701d..fb797b77 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt @@ -1,6 +1,9 @@ package org.luxons.sevenwonders.game -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertTrue import org.junit.Test import org.luxons.sevenwonders.game.api.Action import org.luxons.sevenwonders.game.api.HandCard diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt index 3ae873a2..4b31a1c7 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.game.api -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Assume.assumeTrue import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt index 0f2a3e0c..e5b7af59 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.game.boards import junit.framework.TestCase.assertEquals -import org.junit.Assert.* +import org.junit.Assert.assertFalse +import org.junit.Assert.assertSame +import org.junit.Assert.assertTrue import org.junit.Assume.assumeTrue import org.junit.Rule import org.junit.Test @@ -191,7 +193,6 @@ class BoardTest { assertEquals(5 + gold / 3, score.totalPoints) } - companion object { @JvmStatic diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/MilitaryTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/MilitaryTest.kt index 34a599c9..735dcaad 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/MilitaryTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/MilitaryTest.kt @@ -1,7 +1,6 @@ package org.luxons.sevenwonders.game.boards -import java.util.HashMap - +import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.FromDataPoints @@ -10,8 +9,7 @@ import org.junit.experimental.theories.Theory import org.junit.rules.ExpectedException import org.junit.runner.RunWith import org.luxons.sevenwonders.game.boards.Military.UnknownAgeException - -import org.junit.Assert.assertEquals +import java.util.HashMap @RunWith(Theories::class) class MilitaryTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt index d9c79ac5..4f63557f 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt @@ -1,13 +1,12 @@ package org.luxons.sevenwonders.game.boards +import org.junit.Assert.assertEquals +import org.junit.Assume.assumeTrue import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.junit.Assert.assertEquals -import org.junit.Assume.assumeTrue - @RunWith(Theories::class) class RelativeBoardPositionTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/ScienceTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/ScienceTest.kt index 8c2041e4..4fd02640 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/ScienceTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/ScienceTest.kt @@ -1,13 +1,12 @@ package org.luxons.sevenwonders.game.boards +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.luxons.sevenwonders.game.test.* - -import org.junit.Assert.assertEquals +import org.luxons.sevenwonders.game.test.createScience @RunWith(Theories::class) class ScienceTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt index 68dcd5e7..8b2791a6 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt @@ -1,8 +1,7 @@ package org.luxons.sevenwonders.game.cards -import org.junit.Test - import org.junit.Assert.assertEquals +import org.junit.Test class CardBackTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/DecksTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/DecksTest.kt index 673f8946..ab32937b 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/DecksTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/DecksTest.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.game.cards -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertTrue import org.junit.Assume.assumeTrue import org.junit.Rule import org.junit.Test diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt index d3a533ea..f7ddfb5d 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt @@ -1,8 +1,7 @@ package org.luxons.sevenwonders.game.cards -import org.junit.Test - import org.junit.Assert.assertEquals +import org.junit.Test class HandRotationDirectionTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt index e7c3835a..11794ed8 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.game.cards -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Assume.assumeTrue import org.junit.Test import org.junit.experimental.theories.DataPoints diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt index a26034f2..2fd180c1 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt @@ -1,6 +1,9 @@ package org.luxons.sevenwonders.game.cards -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertSame +import org.junit.Assert.assertTrue import org.junit.Assume.assumeTrue import org.junit.Test import org.junit.experimental.theories.DataPoints diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt index 1b87e593..8c3d6288 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt @@ -19,9 +19,7 @@ class ProductionIncreaseSerializerTest { @Before fun setUp() { - val resourceTypeList = object : TypeToken>() { - - }.type + val resourceTypeList = object : TypeToken>() {}.type gson = GsonBuilder().registerTypeAdapter(Resources::class.java, ResourcesSerializer()) .registerTypeAdapter(MutableResources::class.java, ResourcesSerializer()) .registerTypeAdapter(ResourceType::class.java, ResourceTypeSerializer()) diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt index 24aed03d..31e53d23 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt @@ -21,9 +21,7 @@ class ResourceTypesSerializerTest { } private fun createListTypeToken(): Type { - return object : TypeToken>() { - - }.type + return object : TypeToken>() {}.type } @Test diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt index 426e0f0e..91384922 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt @@ -7,7 +7,9 @@ import org.junit.Assert.assertNull import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.game.resources.MutableResources -import org.luxons.sevenwonders.game.resources.ResourceType.* +import org.luxons.sevenwonders.game.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.resources.ResourceType.WOOD import org.luxons.sevenwonders.game.resources.Resources import org.luxons.sevenwonders.game.resources.emptyResources import org.luxons.sevenwonders.game.resources.resourcesOf diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt index 8899eb06..38da14f8 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt @@ -29,7 +29,12 @@ class BonusPerBoardElementTest { @Theory fun computePoints_countsCards( - boardPosition: RelativeBoardPosition, nbCards: Int, nbOtherCards: Int, points: Int, gold: Int, color: Color + boardPosition: RelativeBoardPosition, + nbCards: Int, + nbOtherCards: Int, + points: Int, + gold: Int, + color: Color ) { val board = table!!.getBoard(0, boardPosition) addCards(board, nbCards, nbOtherCards, color) @@ -41,7 +46,10 @@ class BonusPerBoardElementTest { @Theory fun computePoints_countsDefeatTokens( - boardPosition: RelativeBoardPosition, nbDefeatTokens: Int, points: Int, gold: Int + boardPosition: RelativeBoardPosition, + nbDefeatTokens: Int, + points: Int, + gold: Int ) { val board = table!!.getBoard(0, boardPosition) for (i in 0 until nbDefeatTokens) { @@ -68,7 +76,12 @@ class BonusPerBoardElementTest { @Theory fun apply_countsCards( - boardPosition: RelativeBoardPosition, nbCards: Int, nbOtherCards: Int, points: Int, gold: Int, color: Color + boardPosition: RelativeBoardPosition, + nbCards: Int, + nbOtherCards: Int, + points: Int, + gold: Int, + color: Color ) { val board = table!!.getBoard(0, boardPosition) addCards(board, nbCards, nbOtherCards, color) @@ -82,9 +95,7 @@ class BonusPerBoardElementTest { } @Theory - fun apply_countsDefeatTokens( - boardPosition: RelativeBoardPosition, nbDefeatTokens: Int, points: Int, gold: Int - ) { + fun apply_countsDefeatTokens(boardPosition: RelativeBoardPosition, nbDefeatTokens: Int, points: Int, gold: Int) { val board = table!!.getBoard(0, boardPosition) for (i in 0 until nbDefeatTokens) { board.military.defeat() diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt index 2cd54b2e..8d22497d 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt @@ -26,8 +26,11 @@ class DiscountTest { @Theory fun apply_doesNotAffectOtherResources( - discountedPrice: Int, discountedType: ResourceType, provider: Provider, - otherType: ResourceType, otherProvider: Provider + discountedPrice: Int, + discountedType: ResourceType, + provider: Provider, + otherType: ResourceType, + otherProvider: Provider ) { Assume.assumeTrue(otherProvider != provider) Assume.assumeTrue(otherType != discountedType) diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt index 7973131c..225ffcbb 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.game.effects -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt index db13e641..6b4cd8f3 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt @@ -16,8 +16,14 @@ class ScienceProgressTest { @Theory fun apply_initContainsAddedScience( - initCompasses: Int, initWheels: Int, initTablets: Int, initJokers: Int, - compasses: Int, wheels: Int, tablets: Int, jokers: Int + initCompasses: Int, + initWheels: Int, + initTablets: Int, + initJokers: Int, + compasses: Int, + wheels: Int, + tablets: Int, + jokers: Int ) { val board = testBoard(ResourceType.ORE) val initialScience = createScience(initCompasses, initWheels, initTablets, initJokers) diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt index 67537644..032d8a1a 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt @@ -6,7 +6,11 @@ import org.luxons.sevenwonders.game.SimplePlayer import org.luxons.sevenwonders.game.api.Table import org.luxons.sevenwonders.game.resources.Provider.LEFT_PLAYER import org.luxons.sevenwonders.game.resources.Provider.RIGHT_PLAYER -import org.luxons.sevenwonders.game.resources.ResourceType.* +import org.luxons.sevenwonders.game.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.resources.ResourceType.WOOD import org.luxons.sevenwonders.game.test.createTransaction import org.luxons.sevenwonders.game.test.createTransactions import org.luxons.sevenwonders.game.test.testBoard diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt index 79be288f..2566f32f 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt @@ -1,9 +1,17 @@ package org.luxons.sevenwonders.game.resources -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType.* +import org.luxons.sevenwonders.game.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.resources.ResourceType.LOOM +import org.luxons.sevenwonders.game.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.resources.ResourceType.PAPYRUS +import org.luxons.sevenwonders.game.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.resources.ResourceType.WOOD import java.util.EnumSet import java.util.HashSet diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt index 9fa0bc55..a931949f 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt @@ -1,10 +1,19 @@ package org.luxons.sevenwonders.game.resources -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Rule import org.junit.Test import org.junit.rules.ExpectedException -import org.luxons.sevenwonders.game.resources.ResourceType.* +import org.luxons.sevenwonders.game.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.resources.ResourceType.LOOM +import org.luxons.sevenwonders.game.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.resources.ResourceType.PAPYRUS +import org.luxons.sevenwonders.game.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.resources.ResourceType.values import java.util.NoSuchElementException class ResourcesTest { diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt index ac3f72de..e44c38f3 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt @@ -15,8 +15,11 @@ class TradingRulesTest { @Theory fun setCost_overridesCost( - defaultCost: Int, overriddenCost: Int, overriddenProvider: Provider, - provider: Provider, type: ResourceType + defaultCost: Int, + overriddenCost: Int, + overriddenProvider: Provider, + provider: Provider, + type: ResourceType ) { assumeTrue(defaultCost != overriddenCost) assumeTrue(overriddenProvider != provider) diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt index 1a360a77..383c77fa 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt @@ -209,14 +209,19 @@ internal fun playCardWithEffect(player: Player, color: Color, effect: Effect) { card.applyTo(player, noTransactions()) } -internal fun createMove(context: PlayerContext, card: Card, type: MoveType, vararg transactions: ResourceTransaction): Move { +internal fun createMove( + context: PlayerContext, + card: Card, + type: MoveType, + vararg transactions: ResourceTransaction +): Move { val playerMove = PlayerMove(type, card.name, Arrays.asList(*transactions)) return type.create(playerMove, card, context) } internal fun singleBoardPlayer(board: Board): Player { - return object: Player { - override val index=0 + return object : Player { + override val index = 0 override val board = board override fun getBoard(relativePosition: RelativeBoardPosition): Board = board } diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt index 3d2f3a80..6c3b933f 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt @@ -1,11 +1,10 @@ package org.luxons.sevenwonders.game.wonders -import org.junit.Test -import org.luxons.sevenwonders.game.cards.CardBack -import org.luxons.sevenwonders.game.test.* - import org.junit.Assert.assertEquals import org.junit.Assert.fail +import org.junit.Test +import org.luxons.sevenwonders.game.cards.CardBack +import org.luxons.sevenwonders.game.test.testWonder class WonderTest { -- cgit