Skip to content

Commit

Permalink
Solved issue "samples for Iterable.toContain.atLeast"
Browse files Browse the repository at this point in the history
added atLeast method to IterableLikeToContainCheckerSamples.kt and added @sample annotation to the corresponding function's KDoc in iterableLikeToContainCheckers.kt

CI needs to ensured as passing upon submission of Pull Request

Resolves robstoll#1545
  • Loading branch information
u7498672 committed Oct 29, 2023
1 parent 0128891 commit 0e7a43c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.*
* @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.atLeast
*
* @since 0.14.0 -- API existed for [Iterable] but not for [IterableLike].
*/
fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.atLeast(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ch.tutteli.atrium.api.fluent.en_GB.samples
import ch.tutteli.atrium.api.fluent.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test
import kotlin.collections.*

class IterableLikeToContainCheckerSamples {
@Test
Expand All @@ -27,4 +28,21 @@ class IterableLikeToContainCheckerSamples {
}
}
}

@Test
fun atLeast() {
expect(listOf("A,B,C,A,B,B")).toContain.inAnyOrder.atLeast(3).entry{
toEqual("B")
}

expect(listOf(1,2,3,4,5,6,4)).toContain.inAnyOrder.atLeast(2).entry{
toEqual(4)
}

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

0 comments on commit 0e7a43c

Please sign in to comment.