JAVA-18133 fix optaplanner test

This commit is contained in:
Loredana Crusoveanu 2023-02-23 14:27:31 +02:00
parent 1bba7257a4
commit 583bde3f6a
4 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<scanAnnotatedClasses/>
<solutionClass>com.baeldung.drools.optaplanner.CourseSchedule</solutionClass>
<entityClass>com.baeldung.drools.optaplanner.Lecture</entityClass>
<scoreDirectorFactory>
<scoreDrl>courseSchedule.drl</scoreDrl>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<scanAnnotatedClasses/>
<solutionClass>com.baeldung.drools.optaplanner.CourseSchedule</solutionClass>
<entityClass>com.baeldung.drools.optaplanner.Lecture</entityClass>
<scoreDirectorFactory>
<easyScoreCalculatorClass>com.baeldung.drools.optaplanner.ScoreCalculator</easyScoreCalculatorClass>

View File

@ -7,7 +7,6 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.optaplanner.core.api.solver.Solver;
import org.optaplanner.core.api.solver.SolverFactory;
import org.optaplanner.core.config.solver.SolverConfig;
public class OptaPlannerUnitTest {
@ -28,8 +27,7 @@ public class OptaPlannerUnitTest {
@Test
public void test_whenCustomJavaSolver() {
SolverConfig solverConfig = SolverConfig.createFromXmlResource("courseScheduleSolverConfiguration.xml");
SolverFactory<CourseSchedule> solverFactory = SolverFactory.create(solverConfig);
SolverFactory<CourseSchedule> solverFactory = SolverFactory.createFromXmlResource("courseScheduleSolverConfiguration.xml");
Solver<CourseSchedule> solver = solverFactory.buildSolver();
CourseSchedule solvedCourseSchedule = solver.solve(unsolvedCourseSchedule);
@ -39,7 +37,6 @@ public class OptaPlannerUnitTest {
@Test
public void test_whenDroolsSolver() {
SolverFactory<CourseSchedule> solverFactory = SolverFactory.createFromXmlResource("courseScheduleSolverConfigDrools.xml");
Solver<CourseSchedule> solver = solverFactory.buildSolver();
CourseSchedule solvedCourseSchedule = solver.solve(unsolvedCourseSchedule);