mihirgune opened a new pull request, #455:
URL: https://github.com/apache/maven-dependency-plugin/pull/455

   ### Description
   
   This Pull Request addresses test flakiness in the following test:
   
   
[`org.apache.maven.plugins.dependency.fromDependencies.TestCopyDependenciesMojo#testGetDependencies`](https://github.com/apache/maven-dependency-plugin/blob/c729702b18a9b496049b0994db7426c72339be75/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java#L566)
   
   #### Problem
   The test performs a `String` equality check on the content of dependencies 
stored in `mojo.resolvedDependencies` against dependencies resolved through 
`mojo.getDependencySets(true).getResolvedDependencies()`.
   
   Since these dependencies are stored in `java.util.Set` collections, their 
ordering is non-deterministic, which occasionally causes test failures when 
executed with the Nondex plugin.
   
   #### Solution
   To address this, I modified the test to verify that the sets contain the 
same elements, regardless of order.
   
   I've changed the assertion from:
   ```
   assertEquals(
       mojo.getResolvedDependencies(true).toString(),
       mojo.getDependencySets(true).getResolvedDependencies().toString()
   );
   ```
   
   to 
   ```
   assertTrue(
       mojo.getResolvedDependencies(true).containsAll(
           mojo.getDependencySets(true).getResolvedDependencies()
       )
   );
   ```
   
   This ensures the test passes as long as both sets contain the same 
dependencies, regardless of order.
   
   I'd appreciate any feedback on this approach and am open to making further 
adjustments if necessary.
   
    - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   


-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to