-
Bug
-
Resolution: Done
-
Minor
-
None
-
None
-
2021 Week 07-09 (from Feb 15)
-
3
-
Undefined
-
NEW
-
NEW
This test succeeds:
@Test
void personConflict() {
constraintVerifier.verifyThat(VaccinationScheduleConstraintProvider::personConflict)
.given(
new Injection(1, VACCINATION_CENTER_1, 0, MONDAY_0900, VaccineType.PFIZER, ANN),
new Injection(2, VACCINATION_CENTER_1, 0, MONDAY_1000, VaccineType.PFIZER, BETH),
new Injection(3, VACCINATION_CENTER_1, 0, MONDAY_1100, VaccineType.PFIZER, ANN)
)
.penalizesBy(1);
}
This test doesn't succeed:
@Test
void personConflict() {
constraintVerifier.verifyThat(VaccinationScheduleConstraintProvider::personConflict)
.given(
new Injection(1, VACCINATION_CENTER_1, 0, MONDAY_0900, VaccineType.PFIZER, ANN),
new Injection(1, VACCINATION_CENTER_1, 0, MONDAY_1000, VaccineType.PFIZER, BETH),
new Injection(1, VACCINATION_CENTER_1, 0, MONDAY_1100, VaccineType.PFIZER, ANN)
)
.penalizesBy(1);
}
But the error message has nothing to do with the actual cause:
java.lang.AssertionError: Broken expectation.
Constraint: org.acme.vaccinationscheduler.domain/Person conflict
Expected penalty: 1 (class java.lang.Integer)
Actual penalty: 0 (class java.lang.Long)
Explanation of score (0hard/0medium/0soft):
Constraint match totals:
0: constraint (Person conflict) has 0 matches:
Indictments:
Notice that the real problem - the only difference - is that the @PlanningId is 3 times the same in the second code.