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

isSameAs

fun <T> Expect<T>.isSameAs(expected: T): Expect<T>

Expects that the subject of the assertion is the same instance as expected.

val list = listOf(3)
expect(list).isSameAs(list)

fails {
    // fails because isSameAs is based on identity, use toBe for equality
    expect(listOf(3)).isSameAs(listOf(3))
}

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.