All flaky tests fixed for the biojava-structure module #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed the following Flaky Tests:
' org.biojava.nbio.structure.io.TestMMCIFWriting#test1A2C
org.biojava.nbio.structure.io.TestMMCIFWriting#test1SMT
org.biojava.nbio.structure.io.TestMMCIFWriting#test2N3J
org.biojava.nbio.structure.io.TestMMCIFWriting#testBiounitWriting
org.biojava.nbio.structure.TestStructureSerialization#testSerializeStructure '
This commit fixes all the flaky tests in the biojava-structure module.
The above-mentioned tests fail because of non-determinism caused due to various reasons. Because the order of elements in Array objects("methods" and "fields") is not deterministic, these tests can fail for a different order. Sorting the fields makes these tests pass.
Also, the Oracle specification about HashMap says that “This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.” The documentation is here for your reference:https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html
So, we have changed it to LinkedHashMap for making the tests execute deterministically.
checkIfValidStrForIntConversion() module is added SimpleMMcifParser to get rid of the bug that still allowed non parsable Integers to be passed to Integer.parseInt().