assertk / assert

assert

fun <T> assert(actual: T, name: String? = null): Assert<T>
Deprecated: Renamed assertThat

Platform and version requirements: Common

Asserts on the given value with an optional name.

assert(true, name = "true").isTrue()
fun <T> assert(f: () -> T): Assert<Result<T>>
Deprecated: Renamed assertThat

Platform and version requirements: Common

Asserts on the given block returning an Assert<Result<T>>. You can test that it returns a value or throws an exception.

assert { 1 + 1 }.isSuccess().isPositive()

assert {
  throw Exception("error")
}.isFailure().hasMessage("error")