assertThat
fun <T> assertThat(actual: T, name: String? = null, displayActual: (T) -> String = { display(it) }): Assert<T>
Asserts on the given value with an optional name.
assertThat(true, name = "true").isTrue()
Content copied to clipboard
Asserts on the given property reference using its name, if no explicit name is specified. This method should be preferred in cases, where property references can be used, as it uses the property's name for the assertion automatically. The name may optionally be overridden, if needed.
data class Person(val name: String)
val p = Person("Hugo")
assertThat(p::name).contains("u")
Content copied to clipboard