This repository was archived by the owner on Mar 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f75a9fc
commit 0778e7e
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/test/kotlin/org/quicache/engine/extension/ListExtensionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.quicache.engine.extension | ||
|
||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.shouldNotBe | ||
|
||
class ListExtensionTest : FunSpec({ | ||
|
||
context("getIndexOrElse") { | ||
test("on index not defined returns null") { | ||
val listResult = listOf("rock", "and", "roll").toList() | ||
val idxValue = listResult.getIndexOrElse(4, "nothing") | ||
idxValue shouldNotBe null | ||
idxValue shouldBe "nothing" | ||
} | ||
|
||
test("on index defined returns value") { | ||
val listResult = listOf("rock", "and", "roll").toList() | ||
val idxValue = listResult.getIndexOrElse(1, "nothing") | ||
idxValue shouldNotBe null | ||
idxValue shouldBe listResult[1] | ||
} | ||
} | ||
}) |