Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
add list extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arieldossantos committed Apr 9, 2021
1 parent f75a9fc commit 0778e7e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/kotlin/org/quicache/engine/extension/ListExtensionTest.kt
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]
}
}
})

0 comments on commit 0778e7e

Please sign in to comment.