exactly
Restricts a contains assertion by specifying that the number of occurrences of the value which we are looking for occurs exactly number of times within the search input.
Return
The newly created builder.
Parameters
The number which the check will compare against the actual number of times an expected value is found in the input of the search.
Throws
In case times is zero; use notToContain instead.
Samples
expect("ABCBAC") toContain o exactly 2 value "C"
fails {
expect("ABBBBCD") toContain o exactly 3 value "B"
}Restricts a contains assertion by specifying that the number of occurrences of the entry which we are looking for occurs exactly number of times within the IterableLike.
Return
The newly created builder.
Since
0.14.0 -- API existed for Iterable but not for IterableLike.
Parameters
The number which the check will compare against the actual number of times an expected entry is found in the IterableLike.
Throws
In case times is zero; use notToContain instead.
Samples
expect(listOf("A", "B", "A")) toContain o inAny order exactly 2 entry {
it toEqual "A"
}
expect(listOf(1, 2, 3)) toContain o inAny order exactly 2 entry {
it toBeGreaterThan 1
}
fails { // because "B" is more than twice in the List
expect(listOf("A", "B", "B", "B")) toContain o inAny order exactly 2 entry {
it toEqual "B"
}
}
fails { // because only 1 element is less than or equal to 1
expect(listOf(1, 2, 3)) toContain o inAny order exactly 2 entry {
it toBeLessThanOrEqualTo 1
}
}