Skip to content

Commit

Permalink
Add samples for Iterable.toContain.exactly
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos-Tsiougranas committed Sep 29, 2023
1 parent 288b3fe commit a621e4d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> AtLeastCheckerStep<E, T,
* @throws IllegalArgumentException In case [times] is smaller than zero.
* @throws IllegalArgumentException In case [times] is zero; use [notToContain] instead.
*
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.IterableLikeToContainCheckerSamples.exactly
*
* @since 0.14.0 -- API existed for [Iterable] but not for [IterableLike].
*/
fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.exactly(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test

class IterableLikeToContainCheckerSamples {
@Test
fun exactly() {
expect(listOf("A", "B", "A")).toContain.inAnyOrder.exactly(2).entry {
toEqual("A")
}

expect(listOf(1, 2, 3)).toContain.inAnyOrder.exactly(2).entry {
toBeGreaterThan(1)
}

fails {
expect(listOf("A", "B", "A", "C")).toContain.inAnyOrder.exactly(2).entry {
toEqual("B")
}
}

fails {
expect(listOf(1, 2, 3)).toContain.inAnyOrder.exactly(2).entry {
toBeLessThanOrEqualTo(1)
}
}
}
}

0 comments on commit a621e4d

Please sign in to comment.