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

fix flaky tests in DataFieldConverterTest.java #1

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

Conversation

FanYuliang
Copy link
Owner

@FanYuliang FanYuliang commented Oct 18, 2021

Hi,

Since there was no response to hneemann#866, I'm also opening this PR but can revise it if you want.
Also, this PR is related to hneemann#870, but fixed more flaky tests in DataFieldConverterTest.java

By running the following command:
mvn install -DskipTests,
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=de.neemann.digital.core.memory.DataFieldConverterTest

Three tests testMarshalObj, testMarshalObj2, testMarshalObj3 in de.neemann.digital.core.memory.DataFieldConverterTest will fail sometimes.

The reason is that method xStream.toXML() in com.thoughtworks.xstream.XStream is not deterministic: Xstreamer.toXML(object) method first serializes the object using HashMap and then convert the XML object to string in the order of keys in the HashMap. I fixed the flakiness by checking whether the actual output is in the expected list, which contains all the possible XML combination orders.

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.

1 participant