infix fun LocalDateTime.shouldHaveSameYearAs(date: LocalDateTime): Unit
Asserts that this year is the same as date's year
Verifies that this year is the same as date's year, ignoring any other fields. For example, 09/02/1998 10:00:00 has the same year as 10/03/1998 11:30:30, and this assertion should pass for this comparison
Opposite of LocalDateTime.shouldNotHaveSameYearAs
val firstDate = LocalDateTime.of(1998, 2, 9, 10, 0, 0)
val secondDate = LocalDateTime.of(1998, 3, 10, 11, 30, 30)
firstDate shouldHaveSameYearAs secondDate // Assertion passes
val firstDate = LocalDateTime.of(2018, 2, 9, 10, 0, 0)
val secondDate = LocalDateTime.of(1998, 2, 9, 10, 0, 0)
firstDate shouldHaveSameYearAs secondDate // Assertion fails, 2018 != 1998