toContainElementsOf
inline fun <E, T : Iterable<E>> Expect<T>.toContainElementsOf(expectedIterableLike: IterableLike): Expect<T>(source)
Expects that the subject of this
expectation (an Iterable) contains all elements of expectedIterableLike.
It is a shortcut for toContain.inAnyOrder.atLeast(1).elementsOf(expectedIterable)
Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed. This function expects IterableLike (which is a typealias for Any) to avoid cluttering the API.
Return
an Expect for the subject of this
expectation.
Since
0.17.0
Parameters
expectedIterableLike
The IterableLike whose elements are expected to be contained within this Iterable.
Throws
in case expectedIterableLike is not an Iterable, Sequence or one of the Array types or the given expectedIterableLike does not have elements (is empty).
Samples
expect(listOf(1, 2, 2, 4)).toContainElementsOf(listOf(1, 2, 4))
fails {
expect(listOf(1, 2, 2, 4)).toContainElementsOf(listOf(1, 2, 3))
}