Shervin
01/16/2023, 12:58 PMdata class Person (val id: String, val name: String)
I expect sth like the following:
listOf(Person("0", "Tom")).shouldBeEqualToIgnoringFields(listOf(Person("1", "Tom")), Person::id)
do we have this?
🙏Emil Kantis
01/16/2023, 12:59 PMval tom = Person("1", "Tom")
val persons = listOf(Person("0", "Tom"))
persons.forOne {
it.shouldBeEqualToIgnoringFields(tom, Person::id)
}
Shervin
01/16/2023, 1:10 PMShervin
01/16/2023, 1:17 PMshouldContainAllIgnoringFields
that would ideal for me.
one liner assertion for comparing Collections while ignoring a field.Shervin
01/16/2023, 1:18 PMsam
01/16/2023, 1:22 PMShervin
01/16/2023, 1:36 PMDavio
01/16/2023, 2:11 PMsam
01/16/2023, 2:11 PMDavio
01/16/2023, 2:13 PMsam
01/16/2023, 2:14 PMlistA.zip(listB).forAll { (a,b) -> }
Emil Kantis
01/16/2023, 2:16 PMShervin
01/16/2023, 2:16 PMzipSatisfy
compares 1 to 1, right?
where as in Contains items might not be in the exact ordersam
01/16/2023, 2:17 PMDavio
01/16/2023, 2:20 PMShervin
01/16/2023, 2:22 PMShervin
01/16/2023, 2:23 PMShervin
02/07/2023, 8:37 PMfun <T : Any> Iterable<T>.shouldContainAllIgnoringFields(...)
to support comparing Iterables ignoring field(s).
Now my question is may I re-use our current
beEqualToIgnoringFields
that we have, to compare the items in the list?
In other words, can a matcher re-use another matcher?
🙏Davio
02/08/2023, 7:49 AMShervin
02/08/2023, 10:29 AM