toBeEqualComparingTo

infix fun <T : Comparable<T>> Expect<T>.toBeEqualComparingTo(expected: T): Expect<T>(source)

Expects that the subject of this expectation is equal to expected where the comparison is carried out with 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)

Deprecated overload which shall give a hint to the user/guide the user to use toBeTheSamePointInTimeAs instead.

Since

1.0.0