willowtreeapps / assertk

assertions for kotlin inspired by assertj
MIT License
757 stars 84 forks source link

Consider making the semantics of `extracting` more similar to `having` #533

Open grodin opened 4 months ago

grodin commented 4 months ago

One thing worth exploring would be to add in addition to/replace extracting with a version of eachHaving that more directly mirrors having ex:


assertThat(allUsers).eachHaving(User::name).isEqualTo(listOf("Alice", "Bob", "Eve"))

assertThat(allUsers).eachHaving("name") { it.name }.isEqualTo(listOf("Alice", "Bob", "Eve"))



_Originally posted by @evant in https://github.com/willowtreeapps/assertk/issues/521#issuecomment-2030155958_

I thought this was worth keeping around as a separate issue. 

I'm keen to tackle it so opening the issue is as much to help me remember as anything!