You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 06491a7
Browse filesBrowse the repository at this point in the historyBrowse files
Keep JUnit deltas when converting assertEquals, assertNotEquals and assertArrayEquals to AssertJ (#1216)
* Keep non-zero deltas on integral actuals in `JUnitAssertEqualsToAssertThat`
`assertEquals(100, elapsed, 10)` with a `long elapsed` became `assertThat(elapsed).isEqualTo(100)`, silently dropping the tolerance, and `assertEquals(1.5, count, 0.5)` became an `isEqualTo` that can never pass. JUnit widens the actual to the `float` or `double` delta type, so the recipe now casts it the same way and keeps the tolerance, as in `assertThat((float) elapsed).isCloseTo(100, within((float) 10))`. The delta is only dropped when it is a literal zero and both values are `int` or `long`.
* Tell deltas from messages by the resolved overload in `assertNotEquals` and `assertArrayEquals`
Like `assertEquals` before #911, `JUnitAssertNotEqualsToAssertThat` and `JUnitAssertArrayEqualsToAssertThat` decided whether the third argument was a delta from that argument's own type. So `assertNotEquals(0.0, d, 0)` became `.as(0)`, and `assertNotEquals(5, count, 1.0)` called an `isNotCloseTo(int, Offset<Double>)` that doesn't exist. Both now use the resolved parameter type and cast the actual and delta where JUnit widened them, sharing the helpers with `JUnitAssertEqualsToAssertThat`.
0 commit comments