Skip to content

Flaky Test: toStringWithUnprocessedProps due to Strict JSON Ordering #515

@zhihao11ui

Description

@zhihao11ui

I encountered a potential flaky test when running the following command: mvn edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.everit.json.schema.ObjectSchemaTest#toStringWithUnprocessedProps -DfailIfNoTests=false

The test toStringWithUnprocessedProps fails intermittently because it uses the sameJsonAs function, which ultimately relies on deepEqualArrays to compare JSON objects. This function enforces strict order of elements in the JSON arrays. As a result, this test is prone to failure when the order of elements is altered, even if the content is otherwise valid.

Suggested Fix:
I propose switching the JSON comparison in this test to use JSONAssert, which is more tolerant of ordering differences in JSON arrays while still ensuring the content is correct. This should resolve the flaky behavior and make the test more reliable across different runs.

I will submit a pull request to apply this change. Let me know if any further details are needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions