doc / ch.tutteli.atrium.api.fluent.en_GB / toHaveSize

toHaveSize

fun <T : Collection<*>> Expect<T>.toHaveSize(expected: Int): Expect<T> (source)

Expects that the subject of this expectation (a Collection) has the given expected size.

Shortcut for size.toEqual(expected).

expect(listOf(1, 2, 3)).toHaveSize(3)

fails {
    expect(listOf(1, 2, 3)).toHaveSize(1)
}

Return
an Expect for the subject of this expectation.

Since
0.17.0