assertk.assertions / index

index

fun <T> Assert<Array<T>>.index(index: Int, f: (Assert<T>) -> Unit): Unit
Deprecated: Use index(index) instead.

Platform and version requirements: Common

Returns an assert that assertion on the value at the given index in the array.

assertThat(arrayOf(0, 1, 2)).index(1) { it.isPositive() }
fun <T> Assert<Array<T>>.index(index: Int): Assert<T>

Platform and version requirements: Common

Returns an assert that assertion on the value at the given index in the array.

assertThat(arrayOf(0, 1, 2)).index(1).isPositive()
fun <T> Assert<List<T>>.index(index: Int, f: (Assert<T>) -> Unit): Unit
Deprecated: Use index(index) instead.

Platform and version requirements: Common

Returns an assert that assertion on the value at the given index in the list.

assertThat(listOf(0, 1, 2)).index(1) { it.isPositive() }
fun <T> Assert<List<T>>.index(index: Int): Assert<T>

Platform and version requirements: Common

Returns an assert that assertion on the value at the given index in the list.

assertThat(listOf(0, 1, 2)).index(1).isPositive()