elementsOf

Finishes the specification of the sophisticated to contain expectation where all elements of the expectedIterableLike shall be searched, using a non-disjoint search.

Delegates to values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray()) (see values for more information).

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.

By non-disjoint is meant that "aa" in "aaaa" is found three times and not only two times.

Return

an Expect for the subject of this expectation.

Since

0.13.0

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within the input of the search.

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

// `elementsOf` is a final step in the CharSequence.toContain expectation-building process and can be used with
// various checkers (see CharSequenceToContainCheckerSamples)

expect("ABC").toContain.exactly(1).elementsOf(listOf("A", "B", "C"))
expect("AAABC").toContain.atMost(3).elementsOf(listOf("A", "B", "C"))
expect("ABBBCD").toContain.atLeast(1).elementsOf(listOf("A", "B", "C", "D"))

fails {
    expect("AAAAAABBBB").toContain.atMost(3).elementsOf(listOf("A", "B"))
}
fails {
    expect("AAABBBB").toContain.exactly(3).elementsOf(listOf("A", "B"))
}
fails {
    expect("AAAAAABBBB").toContain.atLeast(3).elementsOf(listOf("A", "B", "C"))
}

@JvmName(name = "elementsOfIgnoringCase")
fun <T : CharSequence> CharSequenceContains.CheckerStep<T, IgnoringCaseSearchBehaviour>.elementsOf(expectedIterableLike: IterableLike): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where all elements of the expectedIterableLike shall be searched (ignoring case), using a non-disjoint search.

Delegates to values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray()) (see values for more information).

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.

By non-disjoint is meant that "aa" in "aaaa" is found three times and not only two times.

Return

an Expect for the subject of this expectation.

Since

0.13.0

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within the input of the search.

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

// `elementsOf` is a final step in the CharSequence.toContain expectation-building process and can be used with
// various checkers (see CharSequenceToContainCheckerSamples)

expect("ABc").toContain.ignoringCase.exactly(1).elementsOf(listOf("A", "b", "C"))
expect("AaaBC").toContain.ignoringCase.atMost(3).elementsOf(listOf("A", "B", "c"))
expect("ABBBcD").toContain.ignoringCase.atLeast(1).elementsOf(listOf("a", "b", "C", "d"))

fails {
    expect("AAAAAABBBB").toContain.ignoringCase.atMost(3).elementsOf(listOf("a", "b"))
}
fails {
    expect("AAABBBB").toContain.ignoringCase.exactly(3).elementsOf(listOf("A", "b"))
}
fails {
    expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).elementsOf(listOf("a", "b", "C"))
}

@JvmName(name = "elementsOfIgnoringCase")
fun <T : CharSequence> CharSequenceContains.EntryPointStep<T, IgnoringCaseSearchBehaviour>.elementsOf(expectedIterableLike: IterableLike): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where all elements of the expectedIterableLike shall be searched (ignoring case), using a non-disjoint search.

Delegates to values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray()) (see values for more information).

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.

By non-disjoint is meant that "aa" in "aaaa" is found three times and not only two times.

Return

an Expect for the subject of this expectation.

Since

0.13.0

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within the input of the search.

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("AbC").toContain.ignoringCase.elementsOf(listOf("A", "B", "c"))

fails {
    expect("aabaabbb").toContain.ignoringCase.elementsOf(listOf("A", "B", "C"))
}

Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain all elements of the expectedIterableLike where it does not matter in which order they appear.

Delegates to values which also means that it does not search for unique matches (see values for more information).

Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed (this can be changed via IterableLikeToIterableTransformer). 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.14.0 -- API existed for Iterable since 0.13.0 but not for IterableLike.

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within this IterableLike.

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).


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only and all elements of expectedIterableLike where it does not matter in which order.

Delegates to values.

Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed (this can be changed via IterableLikeToIterableTransformer). 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.14.0 -- API existed for Iterable since 0.13.0 but not for IterableLike.

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within this IterableLike

report

The lambda configuring the InAnyOrderOnlyReportingOptions -- it is optional where the default InAnyOrderOnlyReportingOptions apply if not specified. since 0.18.0

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).


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only and all elements of expectedIterableLike in the specified order.

Delegates to values.

Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed (this can be changed via IterableLikeToIterableTransformer). 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.14.0 -- API existed for Iterable since 0.13.0 but not for IterableLike.

Parameters

expectedIterableLike

The IterableLike whose elements are expected to be contained within this IterableLike.

report

The lambda configuring the InOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.17.0

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).