toBeEqualComparingTo

Expects that the subject of this expectation is equal to expected where the comparison is carried out based on Comparable.compareTo.

Use toEqual if you want a comparison based on Any.equals.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect(2).toBeEqualComparingTo(2)

fails {
    expect(1).toBeEqualComparingTo(2)
    expect(2).toBeEqualComparingTo(1)
}

Deprecated

'toBeEqualComparingTo' is deprecated in favour of 'toBeTheSamePointInTimeAs' which is based on ChronoZonedDateTime.isEqual instead of compareTo

Replace with

toBeTheSamePointInTimeAs(expected)