prathyushreddylpr opened a new pull request, #1504:
URL: https://github.com/apache/cxf/pull/1504

   ### Description
   Fixed the flaky test `testGetFiles` inside `FileUtilsTest.java` class. 
   
   
https://github.com/apache/cxf/blob/8b205c8086aeb1f5514472f0802c1fb7d510a50e/core/src/test/java/org/apache/cxf/helpers/FileUtilsTest.java#L70
   
   #### Root Cause
   The test `testGetFiles` has been reported as flaky when run with the 
[NonDex](https://github.com/TestingResearchIllinois/NonDex) tool. The test 
failed because it is trying to compare contents in two lists, but since the 
order is not maintained in lists the assert is failing. The List in Java is 
implemented in such a way that it does not store the order in which the values 
are inserted. As a result, when both the lists are compared, it caused the 
failure. 
   
   #### Fix
   This test is fixed by first sorting the two lists and then comparing both 
lists.
   
   ### How this has been tested?
   
   **Java:** openjdk version "11.0.20.1"
   **Maven:** Apache Maven 3.6.3
   
   1) **Module build** - Successful
   Command used - 
   ```
   mvn install -pl core -am -DskipTests
   ```
   
   2) **Regular test**  - Successful
   Command used - 
   ```
   mvn -pl core test -Dtest=org.apache.cxf.helpers.FileUtilsTest#testGetFiles
   ```
   
   3) **NonDex test**  - Failed
   Command used - 
   ```
   mvn -pl core edu.illinois:nondex-maven-plugin:2.1.7-SNAPSHOT:nondex 
-Dtest=org.apache.cxf.helpers.FileUtilsTest#testGetFiles
   ```
   
   NonDex test passed after the fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to