-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
2020 Week 16-18 (from Apr 13)
-
1
-
NEW
-
NEW
To reproduce, adjust VehicleRoutingConstraintProviderTest to adjust a unit test that a zero score and assert that it has a different score (for example 3000L).
The error message looks like this:
java.lang.AssertionError: Broken expectation. Constraint: org.optaplanner.examples.vehiclerouting.domain/arrivalAfterDueTime Expected penalty: 3000 (class java.lang.Long) Actual penalty: 0 (class java.lang.Integer)
At this point, the "(class java.lang.Integer)" is a "red herring". It's very confusing.
Proposal A)
Remove "(class ...)" if the score is zero
Proposal B)
Fix it properly if possible Have it deduct that it's should say 0 (class java.lang.Long) there.
In fact, if we use a penalisesBy(int) for a BigDecimalSoftScore, I 'd love to see a second line in the error message that says "Maybe call the correct penalizesBy() overloaded method."
Look for usages of the word "Maybe" in optaplanner-core error messages. The idea is the first line shows the problem and the second line suggest a solution that might or might not work (hence the word "maybe").