doc / ch.tutteli.atrium.api.infix.en_GB / atMost

atMost

infix fun <T : CharSequence, S : CharSequenceContains.SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.atMost(times: Int): AtMostCheckerStep<T, S> (source)

Restricts a contains assertion by specifying that the number of occurrences of the value which we are looking for occurs at least once but at most number of times within the search input.

If you want to use a higher lower bound than one, then use atLeast(2).butAtMost(3) instead of atMost(3). And in case you want to state that it is either not contained at all or at most a certain number of times, then use notOrAtMost(2) instead.

Parameters

times - The number which the check will compare against the actual number of times an expected value is found in the input of the search.

Exceptions

IllegalArgumentException - In case times is smaller than zero.

IllegalArgumentException - In case times is zero; use notToContain instead.

IllegalArgumentException - In case times equals to one; use exactly instead.

Return
The newly created builder.

infix fun <E, T, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.atMost(times: Int): AtMostCheckerStep<E, T, S> (source)

Restricts a contains assertion by specifying that the number of occurrences of the entry which we are looking for occurs at least once but at most number of times within the IterableLike.

If you want to use a higher lower bound than one, then use atLeast(2).butAtMost(3) instead of atMost(3). And in case you want to state that it is either not contained at all or at most a certain number of times, then use notOrAtMost(2) instead.

Parameters

times - The number which the check will compare against the actual number of times an expected entry is found in the IterableLike.

Exceptions

IllegalArgumentException - In case times is smaller than zero.

IllegalArgumentException - In case times is zero; use notToContain instead.

IllegalArgumentException - In case times equals to one; use exactly instead.

Return
The newly created builder.

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