extracting

fun <E, R> Assert<Array<E>>.extracting(f1: (E) -> R): Assert<List<R>>

Extracts a value of from each item in the array, allowing you to assert on a list of those values.

assertThat(people)
.extracting(Person::name)
.containsExactly("Sue", "Bob")

fun <E, R1, R2> Assert<Array<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2): Assert<List<Pair<R1, R2>>>

Extracts two values of from each item in the array, allowing you to assert on a list of paris of those values.

assertThat(people)
.extracting(Person::name, Person::age)
.containsExactly("Sue" to 20, "Bob" to 22)

fun <E, R1, R2, R3> Assert<Array<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2, f3: (E) -> R3): Assert<List<Triple<R1, R2, R3>>>

Extracts three values from each item in the array, allowing you to assert on a list of triples of those values.

assertThat(people)
.extracting(Person::name, Person::age, Person::address)
.contains(Triple("Sue", 20, "123 Street"), Triple("Bob", 22, "456 Street")

fun <E, R> Assert<Iterable<E>>.extracting(f1: (E) -> R): Assert<List<R>>

Extracts a value of from each item in the iterable, allowing you to assert on a list of those values.

assertThat(people)
.extracting(Person::name)
.containsOnly("Sue", "Bob")

fun <E, R1, R2> Assert<Iterable<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2): Assert<List<Pair<R1, R2>>>

Extracts two values of from each item in the iterable, allowing you to assert on a list of paris of those values.

assertThat(people)
.extracting(Person::name, Person::age)
.containsOnly("Sue" to 20, "Bob" to 22)

fun <E, R1, R2, R3> Assert<Iterable<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2, f3: (E) -> R3): Assert<List<Triple<R1, R2, R3>>>

Extracts three values from each item in the iterable, allowing you to assert on a list of triples of those values.

assertThat(people)
.extracting(Person::name, Person::age, Person::address)
.contains(Triple("Sue", 20, "123 Street"), Triple("Bob", 22, "456 Street")

fun <E, R> Assert<Sequence<E>>.extracting(f1: (E) -> R): Assert<Sequence<R>>

Extracts a value of from each item in the sequence, allowing you to assert on a list of those values.

assertThat(people)
.extracting(Person::name)
.containsExactly("Sue", "Bob")

fun <E, R1, R2> Assert<Sequence<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2): Assert<Sequence<Pair<R1, R2>>>

Extracts two values of from each item in the sequence, allowing you to assert on a list of paris of those values.

assertThat(people)
.extracting(Person::name, Person::age)
.containsExactly("Sue" to 20, "Bob" to 22)

fun <E, R1, R2, R3> Assert<Sequence<E>>.extracting(f1: (E) -> R1, f2: (E) -> R2, f3: (E) -> R3): Assert<Sequence<Triple<R1, R2, R3>>>

Extracts three values from each item in the sequence, allowing you to assert on a list of triples of those values.

assertThat(people)
.extracting(Person::name, Person::age, Person::address)
.contains(Triple("Sue", 20, "123 Street"), Triple("Bob", 22, "456 Street")