Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-791 Search and fix minor errors
  3. RESTWS-800

Assertion arguments should be passed in the correct order

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Could
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: RESTWS 2.30.0
    • Labels:
    • Complexity:
      Low

      Description

      SonarQube:

      The standard assertions library methods such as org.junit.Assert.assertEquals, and org.junit.Assert.assertSame expect the first argument to be the expected value and the second argument to be the actual value. For AssertJ, it's the other way around, the argument of org.assertj.core.api.Assertions.assertThat is the actual value, and the subsequent calls contain the expected values. Swap them, and your test will still have the same outcome (succeed/fail when it should) but the error messages will be confusing.
      This rule raises an issue when the actual argument to an assertions library method is a hard-coded value and the expected argument is not.

      Problem:
      Wrong order of the assertion arguments, which can make it difficult to debug source code.

      Solution:
      Correcting the order of arguments.

      Where the problem occurs:

      Support materials:

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              kellington Kathryn Ellington
              Reporter:
              sacull Lukasz Debicki
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 30 minutes
                  3h 30m