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

asIterable

fun <E, T : Sequence<E>> Expect<T>.asIterable(): Expect<Iterable<E>> (source)

Turns Expect<Sequence<E>> into Expect<Iterable<E>>.

The transformation as such is not reflected in reporting. Use feature(Sequence::asIterable) if you want to show the transformation in reporting.

expect(sequenceOf(1, 2, 3))
    .asIterable() // subject is now of type Iterable<Int>
    .toContain
    .inOrder // order specifier
    .only
    .values(1, 2, 3)

fails {
    expect(sequenceOf(1, 2, 3))
        .asIterable() // subject is now of type Iterable<Int>
        .toContain(4)
}

Return
The newly created Expect for the transformed subject.

fun <E, T : Sequence<E>> Expect<T>.asIterable(assertionCreator: Expect<Iterable<E>>.() -> Unit): Expect<T> (source)

Expects that the subject of this expectation holds all assertions the given assertionCreator creates for the subject as Iterable.

The transformation as such is not reflected in reporting. Use feature(Sequence::asIterable, assertionCreator) if you want to show the transformation in reporting.

expect(sequenceOf(1, 2, 3))
    .asIterable { // subject within this block is of type Iterable<Int>
        toContain(1)
        toContain(2)
        toContain(3)
    } // subject here is back to type Sequence<Int>

fails {
    expect(sequenceOf(1, 2, 3))
        .asIterable { // subject within this block is of type Iterable<Int>
            toContain(4)
        } // subject here is back to type Sequence<Int>
}

Return
an Expect for the subject of this expectation.