Skip to content

Commit

Permalink
Merge pull request #1531 from Nikos-Tsiougranas/#1515-add-butAtMost-test
Browse files Browse the repository at this point in the history
Add butAtMost sample test and link it with the corresponding function
  • Loading branch information
robstoll authored Aug 29, 2023
2 parents c47417c + f2de253 commit 99181ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<
* @throws IllegalArgumentException In case [times] is zero; use [notToContain] instead.
* @throws IllegalArgumentException In case [times] of this `at most` restriction equals to the number of the
* `at least` restriction; use the [exactly] restriction instead.
*
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCheckerSamples.butAtMost
*
*/
fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerStep<T, S>.butAtMost(
times: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ class CharSequenceToContainCheckerSamples {
expect("ABB").toContain.atLeast(2).value("A")
}
}

@Test
fun butAtMost() {
expect("ABBC").toContain.atLeast(1).butAtMost(2).value("B")

fails {
expect("ABBBBCD").toContain.atLeast(2).butAtMost(3).value("B")
}
}
}

0 comments on commit 99181ca

Please sign in to comment.