Skip to content

Conversation

@contextshuffling
Copy link
Contributor

@contextshuffling contextshuffling commented Oct 16, 2019

Test case testSerialization is trying to test the serialization of CompositeHealthIndicator. However, there is a subtle dependency that the serialization depends on, which is the iteration order of HashMap it uses. However, HashMap does not guarantee any specific order of entries. Therefore, the assertions will fail if the order is different.
Test cases should pass regardless of the HashMap iteration orders, otherwise it cannot serve as a regression test.

This PR proposes to change HashMap to use LinkedHashMap that makes the iteration order deterministic, which is the insertion order. The test also assumes this order so no need to modify the test assertion.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 16, 2019
@omix222

This comment has been minimized.

@wilkinsona wilkinsona added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 16, 2019
@wilkinsona wilkinsona added this to the 2.1.x milestone Oct 16, 2019
@snicoll snicoll self-assigned this Oct 16, 2019
@snicoll snicoll modified the milestones: 2.1.x, 2.1.10 Oct 16, 2019
@snicoll snicoll changed the title changing HashMap to LinkedHashMap for deterministic iterations Use LinkedHashSet for deterministic order in test assertion Oct 16, 2019
@snicoll snicoll closed this in 4eaa387 Oct 16, 2019
@snicoll
Copy link
Member

snicoll commented Oct 16, 2019

@contextshuffling thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants