Branch: refs/heads/misc-s5785-equals-contract-tests Home: https://github.com/xwiki/xwiki-platform Commit: 87a7c019edbde0068e1834b59d9f1bfe552f4f30 https://github.com/xwiki/xwiki-platform/commit/87a7c019edbde0068e1834b59d9f1... Author: Vincent Massol <[email protected]> Date: 2026-07-29 (Wed, 29 Jul 2026) Changed paths: M xwiki-platform-core/xwiki-platform-bridge/src/test/java/org/xwiki/bridge/ActionExecutingEventTest.java M xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-api/src/test/java/org/xwiki/eventstream/AbstractRecordableEventDescriptorTest.java M xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-api/src/test/java/org/xwiki/eventstream/SimpleEventQueryTest.java M xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-observation/src/test/java/org/xwiki/observation/ActionExecutionEventTest.java M xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-api/src/test/java/org/xwiki/model/reference/EntityReferenceTest.java M xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-api/src/test/java/org/xwiki/model/reference/RegexEntityReferenceTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiDocumentMockitoTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiLinkTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/objects/NumberPropertyTest.java M xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-api/src/test/java/org/xwiki/refactoring/job/question/EntitySelectionTest.java M xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-api/src/test/java/org/xwiki/security/authorization/RightMapTest.java M xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-api/src/test/java/org/xwiki/security/authorization/RightSetTest.java M xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-api/src/test/java/org/xwiki/url/ExtendedURLTest.java M xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/WebJarResourceReferenceTest.java Log Message: ----------- [Misc] Revert the java:S5785 changes on the equals()/hashCode() contract tests Converting assertTrue/assertFalse(a.equals(b)) into assertEquals/assertNotEquals in tests whose purpose is to verify the equals()/hashCode() contract changes what is being tested. JUnit compares through AssertionUtils.objectsAreEqual(a, b), i.e. a == null ? b == null : a.equals(b), so the call site no longer shows which object is the receiver and which one is the argument, and it invites a later java:S3415 "swap these arguments" change that would call the other object's equals() instead. The 88 assertions concerned are restored to their boolean form in 14 test files, and the reason now lives in the code as @SuppressWarnings("java:S5785") plus an explanatory comment on each contract-test method. Assertions that merely happen to compare two values with equals() in ordinary tests are left converted, as are the hashCode() comparisons outside contract tests. RegexEntityReferenceTest is the clearest case: RegexEntityReference#equals() only runs the regex when the regex reference is the receiver, which is why it already needed a class-level @SuppressWarnings("java:S3415") to stay correct. That suppression is dropped since the assertions call equals() explicitly again. This reverts the equals()/hashCode() contract-test parts of 1eafd658a13, a94435cb30c, ce509be1144 and d5ac2bd37e0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications