You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "XinT (Jira)" <ji...@apache.org> on 2020/10/28 16:18:00 UTC

[jira] [Created] (MATH-1560) testGetAvailableLocales can fail

XinT created MATH-1560:
--------------------------

             Summary: testGetAvailableLocales can fail
                 Key: MATH-1560
                 URL: https://issues.apache.org/jira/browse/MATH-1560
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.6.1
            Reporter: XinT


ComplexFormatAbstractTest.testGetAvailableLocales() is flaky because the return array of the call to NumberFormat.getAvailableLocales() is not always ordered in the same way (eg. alphabetically). In fact, the javadoc of getAvailableLocales() in the ComplexFormat class says the function "get the *set* of locales for which complex formats are available". So the return array should logically be treated as a set. 

I detected this flaky test using a tool called NonDex, which detects flakiness due to wrong assumptions about Java APIs. You can find its [implementation here|https://github.com/TestingResearchIllinois/NonDex] and the [paper here|http://mir.cs.illinois.edu/awshi2/publications/FSEDEMO2016.pdf]. 

My understanding of why this particular test is caught to be flaky is: the spec of NumberFormat.getAvailableLocales() doesn't say the return array is ordered in any way. So the NonDex tool I mentioned shuffles this array, causing the test to fail sometimes, and it decides the test is flaky. 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)