File tree Expand file tree Collapse file tree 3 files changed +28
-25
lines changed
Expand file tree Collapse file tree 3 files changed +28
-25
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ dependencies {
4343 compileOnly(kotlin(" stdlib-jdk8" ))
4444 testImplementation(kotlin(" stdlib-jdk8" ))
4545 testImplementation(kotlin(" test-junit5" ))
46- testImplementation(platform(" org.junit:junit-bom:5.8.1 " ))
46+ testImplementation(platform(" org.junit:junit-bom:5.9.0 " ))
4747 testImplementation(" org.junit.jupiter:junit-jupiter" )
48- testImplementation(" io.mockk:mockk:1.12.0 " )
48+ testImplementation(" io.mockk:mockk:1.12.7 " )
4949
50- val kotestVersion = " 5.0.0.M3 "
50+ val kotestVersion = " 5.4.2 "
5151 testImplementation(" io.kotest:kotest-runner-junit5:$kotestVersion " )
5252 testImplementation(" io.kotest:kotest-framework-datatest:$kotestVersion " )
5353 testImplementation(" io.kotest:kotest-assertions-core:$kotestVersion " )
Original file line number Diff line number Diff line change @@ -31,27 +31,25 @@ internal class ConfigParsingTest : FeatureSpec({
3131
3232 feature("parseSlotPositions") {
3333
34- scenario("valid data") {
35- withData(
36- nameFn = { (value, range) -> "$value -> $range" },
37- "42" to 42..42,
38- "0-0" to 0..0,
39- "9-17" to 9..17,
40- "0-53" to 0..53,
41- ) { (value, range) -> parseSlotPositions(value) shouldBe range }
42- }
34+ // Valid data
35+ withData(
36+ nameFn = { (value, range) -> "$value -> $range" },
37+ "42" to 42..42,
38+ "0-0" to 0..0,
39+ "9-17" to 9..17,
40+ "0-53" to 0..53,
41+ ) { (value, range) -> parseSlotPositions(value) shouldBe range }
4342
44- scenario("not valid data") {
45- withData(
46- nameFn = { "'$it' is not valid range" },
47- "",
48- "-1",
49- "54",
50- "4-2",
51- "0-54",
52- "0..2",
53- "word",
54- ) { value -> shouldThrow<IllegalArgumentException > { parseSlotPositions(value) } }
55- }
43+ // Not valid data
44+ withData(
45+ nameFn = { "'$it' is not valid range" },
46+ "",
47+ "-1",
48+ "54",
49+ "4-2",
50+ "0-54",
51+ "0..2",
52+ "word",
53+ ) { value -> shouldThrow<IllegalArgumentException > { parseSlotPositions(value) } }
5654 }
5755})
Original file line number Diff line number Diff line change @@ -37,8 +37,13 @@ fun Inventory(
3737 val contents = Array (size) { AIR }
3838 return mockk(relaxUnitFun = true ) {
3939 every { getSize() } returns size
40- every { getHolder() } answers { holder ? : InventoryHolder { this @mockk } }
40+ every { getHolder() } answers { holder ? : SimpleInventoryHolder ( this @mockk) }
4141 every { getItem(any()) } answers { contents[firstArg()] }
4242 every { setItem(any(), any()) } answers { contents[firstArg()] = secondArg() }
4343 }
4444}
45+
46+ // Required because of the issue: https://github.com/mockk/mockk/issues/868
47+ private class SimpleInventoryHolder (private val inventory : Inventory ) : InventoryHolder {
48+ override fun getInventory (): Inventory = inventory
49+ }
You can’t perform that action at this time.
0 commit comments