Qi-Cui opened a new pull request, #295: URL: https://github.com/apache/gora/pull/295
### Description Test `org.apache.gora.mongodb.filters.DefaultFactoryTest#testCreateFilter_list_2` occasionally fails when the order of fields in the `JSONObject` objects is different. The root cause is that current test compares the two `JSONObject` objects by converting them to strings, which is order-sensitive, and could fail when field order differs. ### Steps to reproduce Run `mvn test -pl gora-mongodb -Dtest=org.apache.gora.mongodb.filters.DefaultFactoryTest#testCreateFilter_list_2 `. ### Expected Behaviour This test should pass consistently, regardless of the order of fields in the `JSONObject`, as long as the content remains the same. ### Actual Behaviour The test occasionally fails, raise an exception with error message: > DefaultFactoryTest.testCreateFilter_list_2:119 expected:<{"[h.C·T":"text/html","url":"http://www.example.com]"}> but was:<{"[url":"http://www.example.com","h.C·T":"text/html]"}> ### Proposed Solution The solution is to parse both expected and actual `JSONObject` into `JsonNode`, rather than comparing them as strings. Then use Jackson's `ObjectMapper` to compare the two `JsonNode` objects, which ignores the order of the keys. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@gora.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org