Quick testing tips #1


Use infix methods to perform assertions




import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test

class Test {
  @Test
  fun `it should pass`() {
    val meters = 1749
    val expected = "1,5km"

    meters.formatToKm() shouldBe expected
  }
}



Discover Kotest matchers to make readable assertions - many of them are available as infix functions, allowing you to write DSL style tests



Read next:


Loading ...
Failed to load data.