Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort fields in PojoFieldFactory for deterministic order #137

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

hsiangawang
Copy link

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.

@coveralls
Copy link

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 Coverage Status
Change from base Build 306: 0.003%
Covered Lines: 3149
Relevant Lines: 3266

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants