Skip to content

Commit

Permalink
Added samples for IterableExpectations (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak03 authored Oct 16, 2021
1 parent e9b282e commit 5de588f
Show file tree
Hide file tree
Showing 2 changed files with 306 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import ch.tutteli.kbox.identity
*
* @return The newly created builder.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainBuilder
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toContain(
Expand All @@ -32,6 +34,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toContain(
*
* @return The newly created builder.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.notToContainBuilder
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.notToContain(
Expand All @@ -45,6 +49,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.notToContain(
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainValue
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toContain(expected: E): Expect<T> =
Expand All @@ -70,6 +76,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toContain(expected: E): Expect<T> =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainValues
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toContain(values: Values<E>): Expect<T> =
Expand All @@ -88,6 +96,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toContain(values: Values<E>): Expect<T>
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainAssertion
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContain(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T> =
Expand All @@ -107,6 +117,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContain(assertionCreatorOrNull
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainAssertions
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContain(entries: Entries<E>): Expect<T> =
Expand All @@ -120,6 +132,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContain(entries: Entries<E>):
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainExactlyValue
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toContainExactly(expected: E): Expect<T> =
Expand All @@ -140,6 +154,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toContainExactly(expected: E): Expect<T
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainExactlyValues
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toContainExactly(values: Values<E>): Expect<T> =
Expand All @@ -162,6 +178,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toContainExactly(values: Values<E>): Ex
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainExactlyAssertion
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContainExactly(
Expand All @@ -187,6 +205,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContainExactly(
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainExactlyAssertions
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContainExactly(entries: Entries<E>): Expect<T> =
Expand All @@ -205,6 +225,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toContainExactly(entries: Entrie
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
* or the given [expectedIterableLike] does not have elements (is empty).
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainExactlyElementsOf
*
* @since 0.17.0
*/
inline infix fun <reified E, T : Iterable<E>> Expect<T>.toContainExactlyElementsOf(
Expand All @@ -224,6 +246,8 @@ inline infix fun <reified E, T : Iterable<E>> Expect<T>.toContainExactlyElements
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
* or the given [expectedIterableLike] does not have elements (is empty).
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toContainElementsOf
*
* @since 0.17.0
*/
inline infix fun <reified E, T : Iterable<E>> Expect<T>.toContainElementsOf(
Expand All @@ -238,6 +262,8 @@ inline infix fun <reified E, T : Iterable<E>> Expect<T>.toContainElementsOf(
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.notToContainValue
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.notToContain(expected: E): Expect<T> =
Expand All @@ -254,6 +280,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.notToContain(expected: E): Expect<T> =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.notToContainValues
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.notToContain(values: Values<E>): Expect<T> =
Expand All @@ -264,6 +292,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.notToContain(values: Values<E>): Expect
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toHaveElements
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toHave(@Suppress("UNUSED_PARAMETER") elements: elements): Expect<T> =
Expand All @@ -274,6 +304,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.toHave(@Suppress("UNUSED_PARAMETER") el
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.notToHaveElements
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.notToHave(@Suppress("UNUSED_PARAMETER") elements: elements): Expect<T> =
Expand All @@ -289,6 +321,8 @@ infix fun <E, T : Iterable<E>> Expect<T>.notToHave(@Suppress("UNUSED_PARAMETER")
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toHaveElementsAndAny
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndAny(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T> =
Expand All @@ -304,6 +338,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndAny(assertionCr
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toHaveElementsAndNone
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndNone(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T> =
Expand All @@ -316,6 +352,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndNone(assertionC
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toHaveElementsAndAll
*
* @since 0.17.0
*/
infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndAll(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T> =
Expand All @@ -327,6 +365,8 @@ infix fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndAll(assertionCr
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.IterableExpectationSamples.toHaveElementsAndNoDuplicates
*
* @since 0.17.0
*/
infix fun <E, T : Iterable<E>> Expect<T>.toHaveElementsAnd(@Suppress("UNUSED_PARAMETER") noDuplicates: noDuplicates): Expect<T> =
Expand Down
Loading

0 comments on commit 5de588f

Please sign in to comment.