summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2018-08-01 00:09:46 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2018-08-01 01:45:04 +0200
commit1e98b6bdf6aac5df09545349373a9f9624f38692 (patch)
tree2c6a9ae994f6c20679c59ac9046a006ce4d0a083
parentAdd history note about Kotlin migration (diff)
downloadseven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.tar.gz
seven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.tar.bz2
seven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.zip
Remove checkstyle and add ktlint
-rw-r--r--backend/build.gradle21
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/actions/CreateGameAction.kt2
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt1
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/validation/DestinationAccessValidator.kt6
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/SevenWondersTest.kt4
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/controllers/GameBrowserControllerTest.kt4
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/controllers/LobbyControllerTest.kt5
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt12
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.kt5
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.kt5
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiBoard.kt11
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiCard.kt11
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiLobby.kt11
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayer.kt8
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayerTurnInfo.kt11
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/test/api/SevenWondersSession.kt4
-rw-r--r--game-engine/build.gradle18
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt4
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt2
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt3
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt2
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt4
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt2
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt2
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt2
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt5
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt5
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/MilitaryTest.kt6
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt5
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/ScienceTest.kt5
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt3
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/DecksTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt3
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt5
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt23
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt7
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt4
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt10
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt6
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt12
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt13
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt7
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt11
-rw-r--r--game-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt7
49 files changed, 185 insertions, 136 deletions
diff --git a/backend/build.gradle b/backend/build.gradle
index af5ed8e2..bc6913c4 100644
--- a/backend/build.gradle
+++ b/backend/build.gradle
@@ -4,20 +4,24 @@ buildscript {
springBootVersion = '2.0.3.RELEASE'
}
repositories {
- mavenCentral()
+ mavenCentral() // for kotlin and spring boot
+ maven {
+ url "https://plugins.gradle.org/m2/" // for ktlint
+ }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
+ classpath "gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:4.1.0"
}
}
-apply plugin: 'checkstyle'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
+apply plugin: "org.jlleitschuh.gradle.ktlint"
group 'org.luxons'
version '1.0-SNAPSHOT'
@@ -40,10 +44,7 @@ compileTestKotlin {
repositories {
mavenCentral()
-}
-
-configurations {
- checkstyleConfig
+ jcenter()
}
dependencies {
@@ -66,14 +67,6 @@ dependencies {
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.hildan.jackstomp:jackstomp:2.0.0'
-
- checkstyleConfig 'org.hildan.checkstyle:checkstyle-config:2.1.0'
-}
-
-checkstyle {
- maxWarnings = 0
- toolVersion = '8.2'
- config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, "checkstyle.xml")
}
// packages the frontend app within the jar
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/actions/CreateGameAction.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/actions/CreateGameAction.kt
index fbe598f2..c10f9c34 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/actions/CreateGameAction.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/actions/CreateGameAction.kt
@@ -17,5 +17,3 @@ class CreateGameAction(
@ApiTypeProperty(required = true)
val gameName: String
)
-
-
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
index 48a31047..4f70468f 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
@@ -67,4 +67,3 @@ internal class PlayerIsNotOwnerException(username: String) :
internal class PlayerNotInGameException(username: String) :
ApiMisuseException("User $username is not in a game, start a game first")
-
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/validation/DestinationAccessValidator.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/validation/DestinationAccessValidator.kt
index 5800edbb..138791fb 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/validation/DestinationAccessValidator.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/validation/DestinationAccessValidator.kt
@@ -11,10 +11,10 @@ class DestinationAccessValidator @Autowired constructor(private val lobbyReposit
fun hasAccess(username: String?, destination: String): Boolean {
return when {
- username == null -> false // unnamed user cannot belong to anything
- hasForbiddenGameReference(username, destination) -> false
+ username == null -> false // unnamed user cannot belong to anything
+ hasForbiddenGameReference(username, destination) -> false
hasForbiddenLobbyReference(username, destination) -> false
- else -> true
+ else -> true
}
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/SevenWondersTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/SevenWondersTest.kt
index cf6c7ce8..e8ffbe42 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/SevenWondersTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/SevenWondersTest.kt
@@ -1,7 +1,9 @@
package org.luxons.sevenwonders
import org.junit.After
-import org.junit.Assert.*
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/GameBrowserControllerTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/GameBrowserControllerTest.kt
index 97873bc1..4c401df6 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/GameBrowserControllerTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/GameBrowserControllerTest.kt
@@ -1,6 +1,8 @@
package org.luxons.sevenwonders.controllers
-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.actions.CreateGameAction
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/LobbyControllerTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/LobbyControllerTest.kt
index e366048f..4780c533 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/LobbyControllerTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/controllers/LobbyControllerTest.kt
@@ -1,6 +1,9 @@
package org.luxons.sevenwonders.controllers
-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.Before
import org.junit.Test
import org.luxons.sevenwonders.actions.ReorderPlayersAction
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
index 84cef934..f989edbc 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
@@ -1,6 +1,10 @@
package org.luxons.sevenwonders.lobby
-import org.junit.Assert.*
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertSame
+import org.junit.Assert.assertTrue
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.BeforeClass
@@ -14,7 +18,11 @@ import org.junit.runner.RunWith
import org.luxons.sevenwonders.game.api.CustomizableSettings
import org.luxons.sevenwonders.game.data.GameDefinition
import org.luxons.sevenwonders.game.data.GameDefinitionLoader
-import org.luxons.sevenwonders.lobby.Lobby.*
+import org.luxons.sevenwonders.lobby.Lobby.GameAlreadyStartedException
+import org.luxons.sevenwonders.lobby.Lobby.PlayerNameAlreadyUsedException
+import org.luxons.sevenwonders.lobby.Lobby.PlayerOverflowException
+import org.luxons.sevenwonders.lobby.Lobby.PlayerUnderflowException
+import org.luxons.sevenwonders.lobby.Lobby.UnknownPlayerException
import java.util.Arrays
@RunWith(Theories::class)
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.kt
index a5009d2a..d22b48e5 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/LobbyRepositoryTest.kt
@@ -1,6 +1,9 @@
package org.luxons.sevenwonders.repositories
-import org.junit.Assert.*
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertSame
+import org.junit.Assert.assertTrue
+import org.junit.Assert.fail
import org.junit.Before
import org.junit.Test
import org.luxons.sevenwonders.lobby.Player
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.kt
index 64e3d8fd..ce370ef5 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/repositories/PlayerRepositoryTest.kt
@@ -1,6 +1,9 @@
package org.luxons.sevenwonders.repositories
-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.Before
import org.junit.Test
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiBoard.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiBoard.kt
index a3d54773..ab14c2df 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiBoard.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiBoard.kt
@@ -1,9 +1,8 @@
package org.luxons.sevenwonders.test.api
-import java.util.Objects
-
import org.luxons.sevenwonders.game.cards.Card
import org.luxons.sevenwonders.game.effects.SpecialAbility
+import java.util.Objects
class ApiBoard {
@@ -33,14 +32,14 @@ class ApiBoard {
var pointsPer3Gold: Int = 0
- override fun equals(o: Any?): Boolean {
- if (this === o) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
return true
}
- if (o == null || javaClass != o.javaClass) {
+ if (other == null || javaClass != other.javaClass) {
return false
}
- val apiBoard = o as ApiBoard?
+ val apiBoard = other as ApiBoard?
return (playerIndex == apiBoard!!.playerIndex && gold == apiBoard.gold && pointsPer3Gold == apiBoard.pointsPer3Gold && wonder == apiBoard.wonder && playedCards == apiBoard.playedCards && production == apiBoard.production && publicProduction == apiBoard.publicProduction && science == apiBoard.science && tradingRules == apiBoard.tradingRules && military == apiBoard.military && specialAbilities == apiBoard.specialAbilities && consumedFreeCards == apiBoard.consumedFreeCards && copiedGuild == apiBoard.copiedGuild)
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiCard.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiCard.kt
index 2f473367..9cbbcbfe 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiCard.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiCard.kt
@@ -1,9 +1,8 @@
package org.luxons.sevenwonders.test.api
-import java.util.Objects
-
import org.luxons.sevenwonders.game.cards.Color
import org.luxons.sevenwonders.game.cards.Requirements
+import java.util.Objects
class ApiCard {
@@ -21,14 +20,14 @@ class ApiCard {
var back: ApiCardBack? = null
- override fun equals(o: Any?): Boolean {
- if (this === o) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
return true
}
- if (o == null || javaClass != o.javaClass) {
+ if (other == null || javaClass != other.javaClass) {
return false
}
- val apiCard = o as ApiCard?
+ val apiCard = other as ApiCard?
return name == apiCard!!.name && color === apiCard.color && requirements == apiCard.requirements && chainParent == apiCard.chainParent && chainChildren == apiCard.chainChildren && image == apiCard.image && back == apiCard.back
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiLobby.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiLobby.kt
index 5bc4dad6..487fdede 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiLobby.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiLobby.kt
@@ -1,9 +1,8 @@
package org.luxons.sevenwonders.test.api
-import java.util.Objects
-
import org.luxons.sevenwonders.game.api.CustomizableSettings
import org.luxons.sevenwonders.lobby.State
+import java.util.Objects
class ApiLobby {
@@ -19,14 +18,14 @@ class ApiLobby {
var state: State? = null
- override fun equals(o: Any?): Boolean {
- if (this === o) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
return true
}
- if (o == null || javaClass != o.javaClass) {
+ if (other == null || javaClass != other.javaClass) {
return false
}
- val apiLobby = o as ApiLobby?
+ val apiLobby = other as ApiLobby?
return (id == apiLobby!!.id && name == apiLobby.name && owner == apiLobby.owner && players == apiLobby.players && settings == apiLobby.settings && state === apiLobby.state)
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayer.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayer.kt
index fc4c01fb..2887b6c7 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayer.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayer.kt
@@ -10,14 +10,14 @@ class ApiPlayer {
var index: Int = 0
- override fun equals(o: Any?): Boolean {
- if (this === o) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
return true
}
- if (o == null || javaClass != o.javaClass) {
+ if (other == null || javaClass != other.javaClass) {
return false
}
- val apiPlayer = o as ApiPlayer?
+ val apiPlayer = other as ApiPlayer?
return index == apiPlayer!!.index && username == apiPlayer.username && displayName == apiPlayer.displayName
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayerTurnInfo.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayerTurnInfo.kt
index ae22cdb6..b1d27db8 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayerTurnInfo.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/ApiPlayerTurnInfo.kt
@@ -1,8 +1,7 @@
package org.luxons.sevenwonders.test.api
-import java.util.Objects
-
import org.luxons.sevenwonders.game.api.Action
+import java.util.Objects
class ApiPlayerTurnInfo {
@@ -20,14 +19,14 @@ class ApiPlayerTurnInfo {
var message: String? = null
- override fun equals(o: Any?): Boolean {
- if (this === o) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
return true
}
- if (o == null || javaClass != o.javaClass) {
+ if (other == null || javaClass != other.javaClass) {
return false
}
- val that = o as ApiPlayerTurnInfo?
+ val that = other as ApiPlayerTurnInfo?
return (playerIndex == that!!.playerIndex && currentAge == that.currentAge && table == that.table && action === that.action && hand == that.hand && neighbourGuildCards == that.neighbourGuildCards && message == that.message)
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/SevenWondersSession.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/SevenWondersSession.kt
index 90b40cb0..e46d4991 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/SevenWondersSession.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/test/api/SevenWondersSession.kt
@@ -2,7 +2,9 @@ package org.luxons.sevenwonders.test.api
import org.hildan.jackstomp.Channel
import org.hildan.jackstomp.JackstompSession
-import org.junit.Assert.*
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertTrue
import org.luxons.sevenwonders.actions.ChooseNameAction
import org.luxons.sevenwonders.actions.CreateGameAction
import org.luxons.sevenwonders.actions.JoinGameAction
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<ScienceType, Int> = mutableMapOf()
+ private val quantities: MutableMap<ScienceType, Int> = 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 <reified T: Any> GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder
- = this.registerTypeAdapter(typeToken<T>(), typeAdapter)
+ private inline fun <reified T : Any> GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder =
+ this.registerTypeAdapter(typeToken<T>(), 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<WonderStageDefinition>,
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<ProductionIncrease>
): 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<ResourceType, Int>) =
fun Iterable<ResourceType>.toResources(): Resources = resourcesOf(this)
-fun Iterable<Resources>.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1}
+fun Iterable<Resources>.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<List<ResourceType>>() {
-
- }.type
+ val resourceTypeList = object : TypeToken<List<ResourceType>>() {}.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<List<ResourceType>>() {
-
- }.type
+ return object : TypeToken<List<ResourceType>>() {}.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 {
bgstack15