Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1321

Use LinkedHashMap for deterministic iteration order

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Done
    • None
    • 1.9.4
    • None
    • None

    Description

      The test opennlp.tools.ml.naivebayes.NaiveBayesSerializedCorrectnessTest#testPlainTextModel can fail due to a different iteration order of HashMap. The error message is as follows:

       

      {{[ERROR] testPlainTextModel(opennlp.tools.ml.naivebayes.NaiveBayesSerializedCorrectnessTest) Time elapsed: 0.01 s <<< FAILURE!
      org.junit.ComparisonFailure:
      expected:<...ports
      ...}}

      The fix is to change HaskMap to LinkedHashMap so that the iteration order remains stable and the failure will not occur any more. In this way, the test will be more stable.

      Attachments

        Activity

          People

            Unassigned Unassigned
            yilinwang Yi-Lin Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: