Open
Description
I regularly find myself in a position where I have an Iterable
of elements, where I want to extract a property which itself is an Iterable
.
Up to this point, I needed to do the following:
assertThat(iterable).extracting { it.anotherIterable }.containsExactly(listOf(elementOne, elementTwo))
or in case of more complex logic
assertThat(iterable).transform { it.flatMap { result -> result.added + result.updated }.containsExactly(elementOne, elementTwo)
Having a function for flat mapping would ease that process:
assertThat(iterable).flatExtracting { it.anotherIterable}.containsExactly(elementOne, elementTwo)
or
assertThat(iterable).flatExtracting { result -> result.added + result.updated }.containsExactly(elementOne, elementTwo)
Metadata
Metadata
Assignees
Labels
No labels