FN on S5863: Compare an object to itself with AssertJ / SoftAssertions

Make sure to read this post before raising a thread here:

  • What language is this for: Java
  • Which rule: S5863
  • Why do you believe it’s a false-positive/false-negative: SoftAssertions do not show when object is compared to itself
  • Are you using
    • SonarQube: 9.9
    • SonarLint: 9.0.0.75308 Intellij 2023.2.2
      • in connected mode with SonarQube
  • How can we reproduce the problem:
class JUnit5SoftAssertionsExample {
  
@Test
  void junit5_soft_assertions_example() {
    String testString = "test";
    assertThat(testString).isEqualTo(testString); // shows Assertions should no compare an object to itself message
    assertSoftly(assertSoftly -> {
       assertSoftly.assertThat(testString).isEqualTo(testString); // no message
    });
   SoftAssertions softAssertions = new SoftAssertions();
   softAssertions.assertThat(testString).isEqualTo(testString); // no message
   softAssertions.assertAll();
  }
}