diff options
Diffstat (limited to 'backend/src/test')
12 files changed, 55 insertions, 36 deletions
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 |