hwu2024 opened a new issue, #2181:
URL: https://github.com/apache/incubator-kie-issues/issues/2181
### Summary
**Modules:** `core/optaplanner-core-impl`
### Steps to Reproduce
Running the test normally:
```bash
mvn -pl core/optaplanner-core-impl test \
-Dtest=org.optaplanner.core.impl.heuristic.selector.move.generic.list.kopt.KOptListMoveIteratorTest#testNonsequentialKOptOnDifferentEntity
```
passes. However, the same test fails when executed under the NonDex plugin,
which perturbs the iteration order:
```bash
mvn -pl core/optaplanner-core-impl \
edu.illinois:nondex-maven-plugin:2.2.1:nondex \
-Dtest=org.optaplanner.core.impl.heuristic.selector.move.generic.list.kopt.KOptListMoveIteratorTest#testNonsequentialKOptOnDifferentEntity
```
The test fails with:
```
Expecting actual:
[null,
"v4",
"e1-extra-0",
"v7",
"e1-extra-3",
"e2-extra-1",
"v2",
"e1-extra-1",
"v6",
"v2",
"e2-extra-2",
"e1-extra-4",
"v9"]
to contain exactly (and in same order):
[null,
"v0",
"e1-extra-0",
"v3",
"e1-extra-3",
"e2-extra-1",
"v8",
"e1-extra-1",
"v2",
"v8",
"e2-extra-2",
"e1-extra-4",
"v5"]
```
The expected and actual results differ only in the v* values
### Root Cause
`Collectors.toMap()` creates a `HashMap` by default. Iterating
`entityToListSize.entrySet()` therefore has unspecified order. The test later
overwrites `removedEdgeList` with a hard‑coded list of expected edges that
assumes a specific iteration order, so the assertion fails when the order
changes.
### Fixes
Make the test deterministic by using `LinkedHashMap` for `entityToListSize`,
so that iteration order reflects the encounter order of `entities`
I am currently working on the fixes and will later provide a PR related to
this issue.
--
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]