openpojo
openpojo copied to clipboard
Sort fields in PojoFieldFactory for deterministic order
The test BusinessIdentityTest.testToString
compares the result with a hardcoded string. However, the function BusinessIdentity.toString
did not return the deterministic string. From code trace, the root cause is the method PojoFieldFactory.getPojoFields
, which calls on Java's reflection api getDeclaredFields
. There is no guarantee in order of the returned fields and thus, some tests can fail due to a different order:
-
BusinessIdentityTest.testToString
-
BusinessIdentityTest.testGetHashCode
This PR proposes to sort the returned fields and make it deterministic.
Pull Request Test Coverage Report for Build 307
- 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.003%) to 96.418%
Totals | |
---|---|
Change from base Build 306: | 0.003% |
Covered Lines: | 3149 |
Relevant Lines: | 3266 |