fun <T : Any> beEqualToIgnoringFields(other: T, vararg fields: KProperty<*>): Matcher<T>
Matcher that compares values without using specific fields
Verifies that two instances are equal by not using only some specific fields. This is useful for matching on objects that contain unknown values, such as a database Entity that contains an ID (you don't know this ID, and it doesn't matter for you, for example)
Example:
data class Foo(val id: Int, val description: String)
val firstFoo = Foo(1, "Bar!")
val secondFoo = Foo(2, "Bar!")
firstFoo should beEqualToIgnoringFields(secondFoo, Foo::id) // Assertion passes
See Also