Copilot commented on code in PR #3187:
URL: 
https://github.com/apache/incubator-kie-optaplanner/pull/3187#discussion_r2660548150


##########
core/optaplanner-core-impl/src/test/java/org/optaplanner/core/impl/heuristic/selector/move/generic/list/kopt/KOptListMoveIteratorTest.java:
##########
@@ -225,7 +226,8 @@ private KOptMoveInfo 
setupValidNonsequential4OptMove(KOptListMoveIteratorMockDat
         Map<Object, Integer> entityToListSize = Arrays.stream(entities)
                 .collect(Collectors.toMap(Function.identity(),
                         entity -> 2,
-                        Integer::sum));
+                        Integer::sum,
+                        LinkedHashMap::new));

Review Comment:
   This fix is incomplete. The same non-deterministic issue exists in the 
setupValidOddSequentialKOptMove method at lines 134-137, where entityToListSize 
is also created using Collectors.toMap without specifying LinkedHashMap::new as 
the map supplier. Both methods iterate over entityToListSize.entrySet() (line 
142 in setupValidOddSequentialKOptMove, line 235 in this method) and rely on 
the iteration order matching the entities array order for correctness. The 
setupValidOddSequentialKOptMove method should receive the same fix to ensure 
full test determinism.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to