RFR: 8285295: Need better testing for IdentityHashMap
ExE Boss
duke at openjdk.java.net
Thu Apr 28 12:23:52 UTC 2022
On Wed, 27 Apr 2022 03:28:09 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> test/jdk/java/util/IdentityHashMap/Basic.java line 77:
>>
>>> 75: E[] contents = (E[]) c.toArray();
>>> 76:
>>> 77: assertEquals(c.size(), given.length);
>>
>> I believe testng has the expected values in front in the `assertEquals` methods, as embodied in the exception messages, so this should be `assertEquals(given.length, c.size());`. Applies to other places.
>
> No, TestNG is `assertEquals(actual, expected)` which is irritatingly the opposite of JUnit.
>
> https://github.com/cbeust/testng/blob/master/testng-asserts/src/main/java/org/testng/asserts/Assertion.java#L151
>
> This will make things quite tedious when/if we convert to JUnit.
There’s a reason why I prefer using [AssertJ], where the calls are:
Assertions.assertThat(actual)
.isEqualTo(expected);
[AssertJ]: https://assertj.github.io/doc
-------------
PR: https://git.openjdk.java.net/jdk/pull/8354
More information about the core-libs-dev
mailing list