-
Enhancement
-
Resolution: Won't Do
-
Minor
-
None
-
8.4.0.Final
-
None
-
Undefined
-
NEW
-
NEW
Current situation:
ConstraintVerifier enforces unique planningIds of different entity instances. If one is null, that's fine. If two are null, it fails fast, which the error message below.
Instead, ConstraintVerifier should only enforce unique planningIds for non-null planningIds. For constraints that don't rely on planningId's, it's a PITA to have to invent planningId's.
java.lang.IllegalStateException: Multiple instances of PlanningEntity-annotated class (PersonAssignment) share the same PlanningId value (null). The instances are ([Ann(null), Beth(null)]). Make sure that IDs of entities passed into the given(...) method are unique. at org.optaplanner.test.impl.score.stream.DefaultSingleConstraintVerification.lambda$assertDistinctPlanningIds$5(DefaultSingleConstraintVerification.java:87) at java.base/java.util.Optional.ifPresent(Optional.java:183) at org.optaplanner.test.impl.score.stream.DefaultSingleConstraintVerification.lambda$assertDistinctPlanningIds$6(DefaultSingleConstraintVerification.java:79) at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603) at org.optaplanner.test.impl.score.stream.DefaultSingleConstraintVerification.assertDistinctPlanningIds(DefaultSingleConstraintVerification.java:62) at org.optaplanner.test.impl.score.stream.DefaultSingleConstraintVerification.given(DefaultSingleConstraintVerification.java:95) at org.optaplanner.test.impl.score.stream.DefaultSingleConstraintVerification.given(DefaultSingleConstraintVerification.java:39)
- is related to
-
PLANNER-2385 ConstraintVerifier must not presume the planningId is a Long (regression)
- Resolved