There was a change around ~v1.30 which added a assertValueRangeForBasicVariables check that throws if the assigned variable is not within the specified values provided by @ValueRangeProvider.
When I use the ConstraintVerifier to unit test a constraint, it can be cumbersome to recreate the full range of possible values.
Basically when you unit test a constraint, you are giving a solution and expecting some weight/scoring for this constraint. The assertValueRange check forces you to recreate a full fledged solution including the possible values, which may add noise and may not be relevant to the unit test. It adds complexity to the test.
The bypass I have is to pin the variable and customize the @ValueRangeProvider to return the pinned variable when pinned = true. It is not ideal. Related issue: #2143
There was a change around ~v1.30 which added a
assertValueRangeForBasicVariablescheck that throws if the assigned variable is not within the specified values provided by@ValueRangeProvider.When I use the
ConstraintVerifierto unit test a constraint, it can be cumbersome to recreate the full range of possible values.Basically when you unit test a constraint, you are giving a solution and expecting some weight/scoring for this constraint. The
assertValueRangecheck forces you to recreate a full fledged solution including the possible values, which may add noise and may not be relevant to the unit test. It adds complexity to the test.The bypass I have is to
pinthe variable and customize the@ValueRangeProviderto return the pinned variable when pinned = true. It is not ideal. Related issue: #2143