@@ -3,11 +3,15 @@ package sc.plugin2021
33import io.kotest.assertions.throwables.shouldNotThrow
44import io.kotest.assertions.throwables.shouldThrow
55import io.kotest.core.spec.style.WordSpec
6+ import io.kotest.matchers.should
67import io.kotest.matchers.shouldBe
78import io.kotest.matchers.shouldNotBe
9+ import io.kotest.matchers.string.shouldContain
10+ import io.kotest.matchers.types.beInstanceOf
811import sc.helpers.testXStream
912import sc.plugin2021.util.Constants
1013import sc.plugin2021.util.GameRuleLogic
14+ import sc.plugin2021.util.MoveMistake
1115import sc.shared.InvalidMoveException
1216
1317class GameStateTest : WordSpec ({
@@ -80,14 +84,21 @@ class GameStateTest: WordSpec({
8084 shouldNotThrow<InvalidMoveException > {
8185 GameRuleLogic .performMove(state, move)
8286 }
83- state.advance(4)
87+ state.advance(3)
88+ state.currentColor shouldBe Color .BLUE
8489 state.undeployedPieceShapes(Color .BLUE ).size shouldBe 20
8590 " throw an InvalidMoveException" {
86- shouldThrow<InvalidMoveException > {
91+ val ex = shouldThrow<InvalidMoveException > {
8792 GameRuleLogic .performMove(state, move)
8893 }
94+ ex.mistake shouldBe MoveMistake .DUPLICATE_SHAPE
95+ state.undeployedPieceShapes(Color .BLUE ).size shouldBe 20
96+ }
97+ " allow a SkipMove" {
98+ GameRuleLogic .performMove(state, SkipMove (Color .BLUE ))
99+ state.lastMove should beInstanceOf<SkipMove >()
100+ testXStream.toXML(state) shouldContain Regex ("lastMove.*SkipMove ")
89101 }
90- state.undeployedPieceShapes(Color .BLUE ).size shouldBe 20
91102 }
92103 " serialised and deserialised" should {
93104 val xStream = testXStream
0 commit comments