Hello everyone!
I have the following data structure:
data class User(
val id: String,
val someTime: LocalDateTime,
val someDetails: SomeDetails,
) {
data class SomeDetails(
val otherId: String,
val otherTime: LocalDateTime,
)
}
val user = User(
id = "1",
someTime = LocalDateTime.now(),
someDetails = User.SomeDetails(
otherId = "a",
otherTime = LocalDateTime.now().plusSeconds(1)
)
)
val otherUser = User(
id = "1",
someTime = LocalDateTime.now().plusHours(1),
someDetails = User.SomeDetails(
otherId = "a",
otherTime = LocalDateTime.now().plusSeconds(22)
)
)
I would like to write a test that ignores both
LocalDateTime
fields.
Something in the lines of:
class SomeTest {
@Test
fun `should ignore localdatetime fields`() {
user.shouldBeEqualToIgnoringFields(otherUser, User::someTime, User.SomeDetails::otherTime)
}
}
Is there any matcher that I might have missed when going through the docs?
Thanks in advance!