Quick testing tips #3


Use collection matchers to assert on collection




import io.kotest.matchers.collections.shouldContain
import org.junit.jupiter.api.Test

class Test3 {
  @Test
  fun `it should pass`() {
    val list = listOf("1", "2", "3", "4", "5")
    list shouldContain "3"
  }
}



Kotest is full of collection matchers - make use of them to make assertions on collections and collection elements



Read next:


Loading ...
Failed to load data.