Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3405

Rule S5863: Assertions should not compare an object to itself

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.5
    • Component/s: Rules

      Description

      AssertJ comparisons:

      assertThat(x).contains(x);
      assertThat(x).containsAll(x);
      assertThat(x).containsAllEntriesOf(x);
      assertThat(x).containsAnyElementOf(x);
      assertThat(x).containsAnyOf(x);
      assertThat(x).containsExactly(x);
      assertThat(x).containsExactlyElementsOf(x);
      assertThat(x).containsExactlyEntriesOf(x);
      assertThat(x).containsExactlyInAnyOrder(x);
      assertThat(x).containsExactlyInAnyOrder(x);
      assertThat(x).containsExactlyInAnyOrderEntriesOf(x);
      assertThat(x).containsOnly(x);
      assertThat(x).containsOnlyElementsOf(x);
      assertThat(x).containsSequence(x);
      assertThat(x).containsSequence(x);
      assertThat(x).containsSequence(x);
      assertThat(x).containsSubsequence(x);
      assertThat(x).containsSubsequence(x);
      assertThat(x).containsSubsequence(x);
      assertThat(x).endsWith(x);
      assertThat(x).endsWith(x);
      assertThat(x).hasSameClassAs(x);
      assertThat(x).hasSameElementsAs(x);
      assertThat(x).hasSameHashCodeAs(x);
      assertThat(x).hasSameSizeAs(x);
      assertThat(x).hasSameSizeAs(x);
      assertThat(x).hasSameSizeAs(x);
      assertThat(x).isEqualTo(x);
      assertThat(x).isEqualToIgnoringCase(x);
      assertThat(x).isSameAs(x);
      assertThat(x).startsWith(x);
      assertThat(x).startsWith(x);
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alban.auzeill Alban Auzeill
                Reporter:
                alban.auzeill Alban Auzeill
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: