@Test void add_vehicle_should_add_vehicle() { VehicleRoutingSolution solution = SolutionFactory.emptySolution(); when(scoreDirector.getWorkingSolution()).thenReturn(solution); PlanningVehicle vehicle = PlanningVehicleFactory.testVehicle(1); AddVehicle addVehicle = new AddVehicle(vehicle); addVehicle.doChange(scoreDirector); assertThat(solution.getVehicleList()).containsExactly(vehicle); verify(scoreDirector).beforeProblemFactAdded(vehicle); verify(scoreDirector).afterProblemFactAdded(vehicle); verify(scoreDirector).triggerVariableListeners(); }
@Override public void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector) { scoreDirector.beforeProblemFactAdded(vehicle); scoreDirector.getWorkingSolution().getVehicleList().add(vehicle); scoreDirector.afterProblemFactAdded(vehicle); scoreDirector.triggerVariableListeners(); }
AddVehicle implements ProblemFactChange<VehicleRoutingSolution> { @Override public void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector) { scoreDirector.beforeProblemFactAdded(vehicle); scoreDirector.getWorkingSolution().getVehicleList().add(vehicle); scoreDirector.afterProblemFactAdded(vehicle); scoreDirector.triggerVariableListeners(); } }
AddVehicle implements ProblemFactChange<VehicleRoutingSolution> { @Override public void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector) { scoreDirector.beforeProblemFactAdded(vehicle); scoreDirector.getWorkingSolution().getVehicleList().add(vehicle); scoreDirector.afterProblemFactAdded(vehicle); scoreDirector.triggerVariableListeners(); } AddVehicle(PlanningVehicle vehicle); }
AddVehicle implements ProblemFactChange<VehicleRoutingSolution> { @Override public void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector) { scoreDirector.beforeProblemFactAdded(vehicle); scoreDirector.getWorkingSolution().getVehicleList().add(vehicle); scoreDirector.afterProblemFactAdded(vehicle); scoreDirector.triggerVariableListeners(); } AddVehicle(PlanningVehicle vehicle); @Override void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector); }
AddVehicle implements ProblemFactChange<VehicleRoutingSolution> { @Override public void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector) { scoreDirector.beforeProblemFactAdded(vehicle); scoreDirector.getWorkingSolution().getVehicleList().add(vehicle); scoreDirector.afterProblemFactAdded(vehicle); scoreDirector.triggerVariableListeners(); } AddVehicle(PlanningVehicle vehicle); @Override void doChange(ScoreDirector<VehicleRoutingSolution> scoreDirector);  }