BDD style
This commit is contained in:
parent
9e8f67ad03
commit
f2adeb5956
|
@ -16,7 +16,7 @@ class ShiftScheduleConstraintProviderUnitTest {
|
|||
ShiftSchedule.class, Shift.class);
|
||||
|
||||
@Test
|
||||
void whenTwoShiftsOnOneDay_thenPenalize() {
|
||||
void givenTwoShiftsOnOneDay_whenApplyingAtMostOneShiftPerDayConstraint_thenPenalize() {
|
||||
Employee ann = new Employee("Ann", null);
|
||||
constraintVerifier.verifyThat(ShiftScheduleConstraintProvider::atMostOneShiftPerDay)
|
||||
.given(ann, new Shift(MONDAY.atTime(6, 0), MONDAY.atTime(14, 0), null, ann), new Shift(MONDAY.atTime(14, 0), MONDAY.atTime(22, 0), null, ann))
|
||||
|
@ -26,7 +26,7 @@ class ShiftScheduleConstraintProviderUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void whenTwoShiftsOnDifferentDays_thenDoNotPenalize() {
|
||||
void givenTwoShiftsOnDifferentDays_whenApplyingAtMostOneShiftPerDayConstraint_thenDoNotPenalize() {
|
||||
Employee ann = new Employee("Ann", null);
|
||||
constraintVerifier.verifyThat(ShiftScheduleConstraintProvider::atMostOneShiftPerDay)
|
||||
.given(ann, new Shift(MONDAY.atTime(6, 0), MONDAY.atTime(14, 0), null, ann), new Shift(TUESDAY.atTime(14, 0), TUESDAY.atTime(22, 0), null, ann))
|
||||
|
@ -34,7 +34,7 @@ class ShiftScheduleConstraintProviderUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void whenEmployeeLacksRequiredSkill_thenPenalize() {
|
||||
void givenEmployeeLacksRequiredSkill_whenApplyingRequiredSkillConstraint_thenPenalize() {
|
||||
Employee ann = new Employee("Ann", Set.of("Waiter"));
|
||||
constraintVerifier.verifyThat(ShiftScheduleConstraintProvider::requiredSkill)
|
||||
.given(ann, new Shift(MONDAY.atTime(6, 0), MONDAY.atTime(14, 0), "Cook", ann))
|
||||
|
@ -42,7 +42,7 @@ class ShiftScheduleConstraintProviderUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void whenEmployeeHasRequiredSkill_thenDoNotPenalize() {
|
||||
void givenEmployeeHasRequiredSkill_whenApplyingRequiredSkillConstraint_thenDoNotPenalize() {
|
||||
Employee ann = new Employee("Ann", Set.of("Waiter"));
|
||||
constraintVerifier.verifyThat(ShiftScheduleConstraintProvider::requiredSkill)
|
||||
.given(ann, new Shift(MONDAY.atTime(6, 0), MONDAY.atTime(14, 0), "Waiter", ann))
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ShiftScheduleSolverUnitTest {
|
|||
private static final Logger logger = LoggerFactory.getLogger(ShiftScheduleSolverUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void whenSolve_thenScoreIsOptimalAndAllShiftsAssigned() {
|
||||
public void given3Employees5Shifts_whenSolve_thenScoreIsOptimalAndAllShiftsAssigned() {
|
||||
SolverFactory<ShiftSchedule> solverFactory = SolverFactory.create(new SolverConfig().withSolutionClass(ShiftSchedule.class)
|
||||
.withEntityClasses(Shift.class)
|
||||
.withConstraintProviderClass(ShiftScheduleConstraintProvider.class)
|
||||
|
|
Loading…
Reference in New Issue