containsExactly

fun Assert<Array<*>>.containsExactly(vararg elements: Any?)

Asserts the array contains exactly the expected elements. They must be in the same order and there must not be any extra elements.

See also

containsAtLeast

fun Assert<List<*>>.containsExactly(vararg elements: Any?)

Asserts the list contains exactly the expected elements. They must be in the same order and there must not be any extra elements.

1, 2 containsExactly 2, 1 fails 1, 2, 2 containsExactly 2, 1 fails 1, 2 containsExactly 1, 2, 2 fails

See also

containsAtLeast
containsOnly
containsExactlyInAnyOrder

fun Assert<Sequence<*>>.containsExactly(vararg elements: Any?)

Asserts the sequence contains exactly the expected elements. They must be in the same order and there must not be any extra elements.

1, 2 containsExactly 2, 1 fails 1, 2, 2 containsExactly 2, 1 fails 1, 2 containsExactly 1, 2, 2 fails

See also

containsAtLeast
containsOnly
containsExactlyInAnyOrder