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

FP in S5853 when assertions "flatExtracting" prevent the chaining

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.11
    • Component/s: Rules
    • Labels:
      None

      Description

      assertThat(record) // FP, can not be chained easily
             .flatExtracting(Record::getSubRecords1)
             .containsExactlyInAnyOrderElementsOf(s1);
      assertThat(record)
             .flatExtracting(Record::getSubRecords2)
             .containsExactlyInAnyOrderElementsOf(s2);
      

      When an assertion in the chain changes the context, it is not possible/cleaner to chain them into one single assertion. We already exclude the names of the methods starting with:

      • extracting
      • using
      • filtered

      We should extend this list to support:

      • flatExtracting

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quentin.jaquier Quentin Jaquier
                Reporter:
                quentin.jaquier Quentin Jaquier
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: