Uploaded image for project: 'Location Based Access Control'
  1. Location Based Access Control
  2. LBAC-30

Wrong use of assertNotNull in EncounterSearchAdviserTest

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Could
    • Resolution: Fixed
    • 0.1.0
    • 0.2.0
    • None

    Description

      EncounterSearchAdviserTest on lines 127, 247, 369, 465, 555, 634, 713, 791 and 869 seems to use assertNotNull method incorrectly, serving no purpose and misleading future contributors.

      The definion of assertNotNull(java.lang.String, java.lang.Object) clearly says that the first argument, message is used for the message which will be displayed if the assertion fails, and second argument, object is checked if it is not null.

      Considering above definition, these lines currently state that empty strings, "" are checked if they are not null (which is always true so this assert makes no sense) and when the assertion fails, the locationUserProperty is displayed as the assertion error message in the console (which was not the intention of the test's creator).

      Instead of this, the single-argument overload, assertNotNull(java.lang.Object) should be used - this way these checks will serve their purpose and won't display misleading error messages.

      The above means that all occurences of assertNotNull(locationUserProperty,""); should become assertNotNull(locationUserProperty); I've applied the fix locally on my clone of the repo and the tests still do pass.

      Gliffy Diagrams

        Attachments

          Activity

            People

              anuar2k Aleksander W
              anuar2k Aleksander W
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: