You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by GitBox <gi...@apache.org> on 2022/12/01 10:18:19 UTC
[GitHub] [olingo-odata2] BoyuLi4 opened a new pull request, #47: Fixed Possible Json Ordering Permutations Problem in Tests
BoyuLi4 opened a new pull request, #47:
URL: https://github.com/apache/olingo-odata2/pull/47
## What is the purpose of the change
In module `odata2-lib/odata-core` test file
```
org.apache.olingo.odata2.core.uri.ExpandSelectTreeCreatorImplTest
```
many tests may have flakiness due to comparisons between two JSON Strings.
However, JsonObject does not guarantee entry orders. Its object is an unordered set of name/value pairs, and just using `assertequal `to compare long JSON string may course some problems.
## Brief changelog
Since the JSON tool used in the Project is GSON, so I used the GSON library `JsonParser `to convert the string back to JSON Object and compare them. when comparing them, thus the equals() method ignores the order and treats them as equal.
## Verifying this change
Use `mvn test` after these changes.
```
[INFO] Running org.apache.olingo.odata2.core.uri.ExpandSelectTreeCreatorImplTest
[INFO] Tests run: 27, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.021 s - in org.apache.olingo.odata2.core.uri.ExpandSelectTreeCreatorImplTest
```
This test avoids nested or different orders of JSON strings that cause flaky errors.
Since I didn't touch any Source code, it should be no impact on the project.
--
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-unsubscribe@olingo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [olingo-odata2] mibo merged pull request #47: Fixed Possible Json Ordering Permutations Problem in Tests
Posted by "mibo (via GitHub)" <gi...@apache.org>.
mibo merged PR #47:
URL: https://github.com/apache/olingo-odata2/pull/47
--
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-unsubscribe@olingo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org