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): AssertBlock<T>
Deprecated: Renamed assertThat

Platform and version requirements: Common

Asserts on the given block. You can test that it returns a value or throws an exception.

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

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