inAny

Finishes the specification of the sophisticated to contain expectation where the expected Order.firstGroup as well as the Order.secondGroup and optionally Order.otherExpectedGroups of values need to be contained in IterableLike in the specified order whereas the values within the groups can occur in any order.

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

order

A parameter object containing the different groups which have to appear in order in the IterableLike -- use order(group, group, ...) to create an Order where group is either value(e) or values(e, ...); so a call could look as follows: `inAny order(values(1, 2), value(2), values(3, 2))


Finishes the specification of the sophisticated to contain expectation where the expected Order.firstGroup as well as the Order.secondGroup and optionally Order.otherExpectedGroups of values need to be contained in IterableLike in the specified order whereas the values within the groups can occur in any order.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

order

A parameter object containing the different groups which have to appear in order in the IterableLike plus one lambda configuring the InOrderOnlyReportingOptions and another configuring the InAnyOrderOnlyReportingOptions -- use the function:

where group above (in all examples) is either value(e) or values(e, ...); so a call could look as follows: `inAny order(values(1, 2), value(2), values(3, 2), report = { showOnlyFailing() })


@JvmName(name = "inAnyOrderEntries")
infix fun <E : Any, T : IterableLike> IterableLikeContains.EntryPointStep<out E?, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAny(order: Order<Expect<E>.() -> Unit?, Group<Expect<E>.() -> Unit?>>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the expected Order.firstGroup as well as the Order.secondGroup and optionally Order.otherExpectedGroups of identification lambdas, identifying an entry, need to be contained in IterableLike in the specified order whereas the identification lambdas within the groups can occur in any order.

An identification lambda can also be defined as null in which case it matches an entry which is null as well.

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

order

A parameter object containing the different groups which have to appear in order in the IterableLike -- use order(group, group, ...) to create an Order where group is either entry { ... } or entries({ ... }, ...); so a call could look as follows:

inAny order(
entry { it toEqual 1 },
entries({ it lessThan 2 }, { it toEqual 3 })
)

Finishes the specification of the sophisticated to contain expectation where the expected Order.firstGroup as well as the Order.secondGroup and optionally Order.otherExpectedGroups of identification lambdas, identifying an entry, need to be contained in IterableLike in the specified order whereas the identification lambdas within the groups can occur in any order.

An identification lambda can also be defined as null in which case it matches an entry which is null as well.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

order

A parameter object containing the different groups which have to appear in order in the IterableLike plus one lambda configuring the InOrderOnlyReportingOptions and another configuring the InAnyOrderOnlyReportingOptions -- use the function:

inAny order(
entry { it toEqual 1 },
entries({ it lessThan 2 }, { it toEqual 3 })
report = { showOnlyFailing }
reportInGroup = { showOnlyFailingIfMoreElementsThan(5) }
)

Defines that the search behaviour "find entries in any order in the IterableLike" shall be applied to this sophisticated to contain in IterableLike expectation.

Return

The newly created builder.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.


Defines that the search behaviour "find entries in any order in the MapLike" shall be applied to this sophisticated to contain in MapLike expectation.

Return

The newly created builder.

Since

0.15.0

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order entry (2 to "b")

fails { // because the value "b" of key 2 (which exists in the subject) is not equal to "c"
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order entry (2 to "c")
}
expect(mapOf(1 to "a")) toContain o inAny order but only entry (1 to "a")

fails { // because subject has additional entries
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only entry (2 to "c")
}