assertContentEquals

fun <T> assertContentEquals(expected: Iterable<T>?, actual: Iterable<T>?, message: String? = null)(source)

Asserts that the expected iterable is structurally equal to the actual iterable, with an optional message.

Two iterables are considered structurally equal if they have the same size, and elements at corresponding positions, following the iteration order, are equal. Elements are compared for equality using the equals function. For floating point numbers, this means NaN is equal to itself and -0.0 is not equal to 0.0.

The iterables are also considered equal if both are null.

Since Kotlin

1.5

fun <T> assertContentEquals(expected: Sequence<T>?, actual: Sequence<T>?, message: String? = null)(source)

Asserts that the expected sequence is structurally equal to the actual sequence, with an optional message.

Two sequences are considered structurally equal if they have the same size, and elements at corresponding positions, following the iteration order, are equal. Elements are compared for equality using the equals function. For floating point numbers, this means NaN is equal to itself and -0.0 is not equal to 0.0.

The sequences are also considered equal if both are null.

Since Kotlin

1.5

fun <T> assertContentEquals(expected: Array<T>?, actual: Array<T>?, message: String? = null)(source)
fun assertContentEquals(expected: FloatArray?, actual: FloatArray?, message: String? = null)(source)
fun assertContentEquals(expected: DoubleArray?, actual: DoubleArray?, message: String? = null)(source)

Asserts that the expected array is structurally equal to the actual array, with an optional message.

Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal. Elements are compared for equality using the equals function. For floating point numbers, this means NaN is equal to itself and -0.0 is not equal to 0.0.

The arrays are also considered equal if both are null.

Since Kotlin

1.5

fun assertContentEquals(expected: ByteArray?, actual: ByteArray?, message: String? = null)(source)
fun assertContentEquals(expected: ShortArray?, actual: ShortArray?, message: String? = null)(source)
fun assertContentEquals(expected: IntArray?, actual: IntArray?, message: String? = null)(source)
fun assertContentEquals(expected: LongArray?, actual: LongArray?, message: String? = null)(source)
fun assertContentEquals(expected: BooleanArray?, actual: BooleanArray?, message: String? = null)(source)
fun assertContentEquals(expected: CharArray?, actual: CharArray?, message: String? = null)(source)
fun assertContentEquals(expected: UByteArray?, actual: UByteArray?, message: String? = null)(source)
fun assertContentEquals(expected: UShortArray?, actual: UShortArray?, message: String? = null)(source)
fun assertContentEquals(expected: UIntArray?, actual: UIntArray?, message: String? = null)(source)
fun assertContentEquals(expected: ULongArray?, actual: ULongArray?, message: String? = null)(source)

Asserts that the expected array is structurally equal to the actual array, with an optional message.

Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.

The arrays are also considered equal if both are null.

Since Kotlin

1.5

fun <T> assertContentEquals(expected: Set<T>?, actual: Set<T>?, message: String? = null)(source)

Deprecated (with error)

'assertContentEquals' for Set arguments is ambiguous. Use 'assertEquals' to compare content with the unordered set equality, or cast one of arguments to Iterable to compare the set elements in order of iteration.

Replace with

assertContentEquals(expected, actual?.asIterable(), message)

Since Kotlin

1.5