inAnyOrder
Finishes the specification of the sophisticated to contain expectation where the expected firstGroup as well as the secondGroup and optionally otherExpectedGroups of values need to be contained in IterableLike as only elements and 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
A group of values which have to appear at first within the IterableLike.
A group of values which have to appear after the values of the firstGroup within the IterableLike.
Additional groups of values which are expected to appear after the secondGroup within IterableLike whereas the groups have to appear in the given order.
The lambda configuring the InOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.17.0
The lambda configuring the InAnyOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.18.0
Finishes the specification of the sophisticated to contain expectation where the expected firstGroup as well as the secondGroup and optionally otherExpectedGroups of identification lambdas, identifying an entry, need to be contained in IterableLike as only elements and 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. Have a look at entries for more information about identification lambdas.
Return
an Expect for the subject of this expectation.
Since
0.14.0 -- API existed for Iterable but not for IterableLike.
Parameters
A group of identification lambdas which have to appear at first within the IterableLike.
A group of identification lambdas which have to appear after the values of the firstGroup within the IterableLike.
Additional groups of values which are expected to appear after the secondGroup within IterableLike whereas the groups have to appear in the given order.
The lambda configuring the InOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.17.0
The lambda configuring the InAnyOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.18.0
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.inAnyOrder.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.inAnyOrder.entry(2 to "c")
}expect(mapOf(1 to "a")).toContain.inAnyOrder.only.entry(1 to "a")
fails { // because subject has additional entries
expect(mapOf(1 to "a", 2 to "b"))
.toContain.inAnyOrder.only.entry(1 to "a")
}