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

Rule S5838: Chained AssertJ assertions should be simplified to the corresponding dedicated assertion

    Details

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

      Description

      This ticket contains many sub-task, to implement it incrementally.

      Sub-tasks will contain two arrays; one with only the most relevant examples (to add in RSPEC) and one with a more complete list (to use as a base for unit tests).
      None of the list are exhaustive, many cases are not present, for example:

      • all the equivalent for "Not"
        assertThat(getObject()).isNotEqualTo(null) to assertThat(getObject()).isNotNull()
      • differents way to write .isTrue()/hasSize(0), ...
        assertThat(getBoolean()).isNotEqualTo(false) to assertThat(getBoolean()).isTrue()

      In addition, noncompliant and compliant examples should be added for each sub-tasks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                johann.beleites Johann Beleites
                Reporter:
                quentin.jaquier Quentin Jaquier
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: