kotest-assertions-core / io.kotest.matchers.collections

Package io.kotest.matchers.collections

Extensions for External Classes

kotlin.Array

kotlin.collections.Collection

kotlin.collections.List

Functions

atLeastSize

fun <T> atLeastSize(n: Int): Matcher<Collection<T>>

atMostSize

fun <T> atMostSize(n: Int): Matcher<Collection<T>>

beEmpty

fun <T> beEmpty(): Matcher<Collection<T>>

beIn

Matcher that verifies that this element is in collection by comparing value

fun <T> beIn(collection: Collection<T>): Matcher<T>

beLargerThan

fun <T, U> beLargerThan(other: Collection<U>): Matcher<Collection<T>>

beMonotonicallyDecreasing

fun <T : Comparable<T>> beMonotonicallyDecreasing(): Matcher<List<T>>

beMonotonicallyDecreasingWith

fun <T> beMonotonicallyDecreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

beMonotonicallyIncreasing

fun <T : Comparable<T>> beMonotonicallyIncreasing(): Matcher<List<T>>

beMonotonicallyIncreasingWith

fun <T> beMonotonicallyIncreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

beOneOf

Matcher that verifies that this instance is in collection

fun <T> beOneOf(collection: Collection<T>): Matcher<T>

beSameSizeAs

fun <T, U> beSameSizeAs(other: Collection<U>): Matcher<Collection<T>>

beSmallerThan

fun <T, U> beSmallerThan(other: Collection<U>): Matcher<Collection<T>>

beSorted

fun <T : Comparable<T>> beSorted(): Matcher<List<T>>

beSortedWith

fun <T> beSortedWith(comparator: Comparator<in T>): Matcher<List<T>>
fun <T> beSortedWith(cmp: (T, T) -> Int): Matcher<List<T>>

beStrictlyDecreasing

fun <T : Comparable<T>> beStrictlyDecreasing(): Matcher<List<T>>

beStrictlyDecreasingWith

fun <T> beStrictlyDecreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

beStrictlyIncreasing

fun <T : Comparable<T>> beStrictlyIncreasing(): Matcher<List<T>>

beStrictlyIncreasingWith

fun <T> beStrictlyIncreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

beUnique

fun <T> beUnique(): Matcher<Collection<T>>

contain

fun <T, C : Collection<T>> contain(t: T): Matcher<C>

containAll

fun <T> containAll(vararg ts: T): Matcher<Collection<T>>
fun <T> containAll(ts: Collection<T>): Matcher<Collection<T>>

containAnyOf

fun <T> containAnyOf(ts: Collection<T>): Matcher<Collection<T>>

containDuplicates

fun <T> containDuplicates(): Matcher<Collection<T>>

containExactly

fun <T> containExactly(vararg expected: T): Matcher<Collection<T>?>

Assert that a collection contains exactly the given values and nothing else, in order.

fun <T, C : Collection<T>> containExactly(expected: C): Matcher<C?>

containExactlyInAnyOrder

fun <T> containExactlyInAnyOrder(vararg expected: T): Matcher<Collection<T>?>

Assert that a collection contains exactly the given values and nothing else, in any order.

fun <T, C : Collection<T>> containExactlyInAnyOrder(expected: C): Matcher<C?>

containNoNulls

fun <T> containNoNulls(): Matcher<Collection<T>>

containNull

fun <T> containNull(): Matcher<Collection<T>>

containOnlyNulls

fun <T> containOnlyNulls(): Matcher<Collection<T>>

containsInOrder

fun <T> containsInOrder(vararg ts: T): Matcher<Collection<T>?>

Assert that a collection contains a given subsequence, possibly with values in between.

fun <T> containsInOrder(subsequence: List<T>): Matcher<Collection<T>?>

endWith

fun <T> endWith(slice: Collection<T>): Matcher<List<T>>

exist

fun <T> exist(p: (T) -> Boolean): Matcher<Collection<T>>

haveElementAt

fun <T, L : List<T>> haveElementAt(index: Int, element: T): Matcher<L>

haveLowerBound

fun <T : Comparable<T>, C : Collection<T>> haveLowerBound(t: T): Matcher<C>

haveSize

fun <T> haveSize(size: Int): Matcher<Collection<T>>

haveSizeMatcher

fun <T> haveSizeMatcher(size: Int): Matcher<Collection<T>>

haveUpperBound

fun <T : Comparable<T>, C : Collection<T>> haveUpperBound(t: T): Matcher<C>

monotonicallyDecreasing

fun <T : Comparable<T>> monotonicallyDecreasing(): Matcher<List<T>>

monotonicallyDecreasingWith

fun <T> monotonicallyDecreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

monotonicallyIncreasing

fun <T : Comparable<T>> monotonicallyIncreasing(): Matcher<List<T>>

monotonicallyIncreasingWith

fun <T> monotonicallyIncreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

printed

fun <T, C : Collection<T>> C.printed(): Printed

shouldBeIn

Verifies that this element is in collection by comparing value

infix fun <T> T.shouldBeIn(collection: Collection<T>): Unit

Verifies that this element is any of any by comparing value

fun <T> T.shouldBeIn(vararg any: T): Unit

shouldBeOneOf

Verifies that this instance is in collection

infix fun <T> T.shouldBeOneOf(collection: Collection<T>): Unit

Verifies that this instance is any of any

fun <T> T.shouldBeOneOf(vararg any: T): Unit

shouldContain

infix fun <T, C : Collection<T>> C.shouldContain(t: T): Unit

shouldContainExactly

infix fun <T, C : Collection<T>> C?.shouldContainExactly(expected: C): Unit

shouldContainExactlyInAnyOrder

infix fun <T, C : Collection<T>> C?.shouldContainExactlyInAnyOrder(expected: C): Unit
fun <T, C : Collection<T>> C?.shouldContainExactlyInAnyOrder(vararg expected: T): Unit

shouldHaveLowerBound

infix fun <T : Comparable<T>, C : Collection<T>> C.shouldHaveLowerBound(t: T): Unit

shouldHaveUpperBound

infix fun <T : Comparable<T>, C : Collection<T>> C.shouldHaveUpperBound(t: T): Unit

shouldNotBeIn

Verifies that this element is NOT any of collection

infix fun <T> T.shouldNotBeIn(collection: Collection<T>): Unit

Verifies that this element is NOT any of any

fun <T> T.shouldNotBeIn(vararg any: T): Unit

shouldNotBeOneOf

Verifies that this instance is NOT in collection

infix fun <T> T.shouldNotBeOneOf(collection: Collection<T>): Unit

Verifies that this instance is NOT any of any

fun <T> T.shouldNotBeOneOf(vararg any: T): Unit

shouldNotContain

infix fun <T, C : Collection<T>> C.shouldNotContain(t: T): Unit

shouldNotContainExactly

infix fun <T, C : Collection<T>> C?.shouldNotContainExactly(expected: C): Unit

shouldNotContainExactlyInAnyOrder

infix fun <T, C : Collection<T>> C?.shouldNotContainExactlyInAnyOrder(expected: C): Unit
fun <T, C : Collection<T>> C?.shouldNotContainExactlyInAnyOrder(vararg expected: T): Unit

singleElement

fun <T> singleElement(t: T): Matcher<Collection<T>>
fun <T> singleElement(p: (T) -> Boolean): Matcher<Collection<T>>

sorted

fun <T : Comparable<T>> sorted(): Matcher<List<T>>

sortedWith

fun <T> sortedWith(comparator: Comparator<in T>): Matcher<List<T>>
fun <T> sortedWith(cmp: (T, T) -> Int): Matcher<List<T>>

startWith

fun <T> startWith(slice: Collection<T>): Matcher<List<T>>

strictlyDecreasing

fun <T : Comparable<T>> strictlyDecreasing(): Matcher<List<T>>

strictlyDecreasingWith

fun <T> strictlyDecreasingWith(comparator: Comparator<in T>): Matcher<List<T>>

strictlyIncreasing

fun <T : Comparable<T>> strictlyIncreasing(): Matcher<List<T>>

strictlyIncreasingWith

fun <T> strictlyIncreasingWith(comparator: Comparator<in T>): Matcher<List<T>>