Replies: 3 comments
-
Hello @ace19wre! The behavior you describe is strange, and could be a bug. |
Beta Was this translation helpful? Give feedback.
-
Hi @triceo, Creating a reproducer is unfortunately a bit beyond my current skills, so I’ve added you to my repository. When you have some time, could you please take a look? I initially thought the issue might be specific to my local setup, but I’m seeing the same listings test error in the GitHub Actions workflow as well. I also tried updating all the project dependencies, but no change. Not only that I observed that my build from 3 weeks ago failed with same behaviour even though I was using Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
-
Having looked over your codebase, I think that this is a misunderstanding of the concepts around penalties and rewards. Penalty/reward for a constraint is calculated from three components:
You can imagine the score being calculated like so (pseudocode):
In your case:
What you're testing in the Constraint weights are not used in this calculation, because they are dynamic and can be overridden at runtime. We have a special section in the docs describing how to test an entire constraint provider, and not just the individual constraints. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So I switched to HardMediumSoftBigDecimalScore from HardMediumSoftLongScore to use the load balancing API.
All of my tests failed.
I wrapped all the penalty values by
BigDecimal.valueOf(XX)
to fix itFor example,
.penalize(HardMediumSoftBigDecimalScore.ofHard(BigDecimal.valueOf(20L)))
has the corresponding test
.penalizesBy(BigDecimal.valueOf(20));
which fails, the test listings output is as follows
The -20 reflects in the score but not in the penalty, how should I correct it?
And why this behaviour?
Beta Was this translation helpful? Give feedback.
All reactions