Uploaded image for project: 'appNG'
  1. appNG
  2. APPNG-2118

WritingJsonValidator should write object attributes in a reproducible order

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.17.0
    • Component/s: appng-testsupport
    • Labels:
      None

      Description

      The WritingJsonValidator can compare an object against json content saved in a file. Unfortunately the order of attributes are not clear defined on serialization. Changing code in the project maybe leads to a different order of attributes.

      This causes test errors even if the test result didn't change because the order of attributes in the json content is different.
       

      By adding

      objectMapper.configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY, true);
      

      The order will always be the same.

      To prevent that this new behavior will lead to test fails, this functionality should be configurable either by additional method or by static attribute like the boolean WritingJsonValidator.writeJson

        Attachments

          Activity

            People

            • Assignee:
              stuemke.claus Claus Stuemke
              Reporter:
              stuemke.claus Claus Stuemke
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: