Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import ai.timefold.solver.core.testdomain.collection.TestdataArrayBasedSolution;
import ai.timefold.solver.core.testdomain.collection.TestdataEntityCollectionPropertyEntity;
import ai.timefold.solver.core.testdomain.collection.TestdataEntityCollectionPropertySolution;
import ai.timefold.solver.core.testdomain.collection.TestdataSetBasedEntity;
import ai.timefold.solver.core.testdomain.collection.TestdataSetBasedSolution;
import ai.timefold.solver.core.testdomain.inheritance.solution.baseannotated.childnot.TestdataOnlyBaseAnnotatedBaseEntity;
import ai.timefold.solver.core.testdomain.inheritance.solution.baseannotated.childnot.TestdataOnlyBaseAnnotatedChildEntity;
Expand Down Expand Up @@ -472,18 +471,18 @@
var val1 = new TestdataValue("1");
var val2 = new TestdataValue("2");
var val3 = new TestdataValue("3");
var a = new TestdataSetBasedEntity("a", val1);
var b = new TestdataSetBasedEntity("b", val1);
var c = new TestdataSetBasedEntity("c", val3);
var d = new TestdataSetBasedEntity("d", val3);
var a = new TestdataEntity("a", val1);
var b = new TestdataEntity("b", val1);
var c = new TestdataEntity("c", val3);
var d = new TestdataEntity("d", val3);

var original = new TestdataSetBasedSolution("solution");
var valueSet = new TreeSet<TestdataValue>((a1, b1) -> {
return b1.getCode().compareTo(a1.getCode()); // Reverse alphabetic
});
valueSet.addAll(Arrays.asList(val1, val2, val3));
original.setValueSet(valueSet);
Comparator<TestdataSetBasedEntity> entityComparator = (a1, b1) -> {
Comparator<TestdataEntity> entityComparator = (a1, b1) -> {
return b1.getCode().compareTo(a1.getCode()); // Reverse alphabetic
};
var originalEntitySet = new TreeSet<>(entityComparator);
Expand Down Expand Up @@ -540,7 +539,7 @@
assertCode("1", cloneB.getValue());
}

private void assertSetBasedEntityClone(TestdataSetBasedEntity originalEntity, TestdataSetBasedEntity cloneEntity,
private void assertSetBasedEntityClone(TestdataEntity originalEntity, TestdataEntity cloneEntity,

Check warning on line 542 in core/src/test/java/ai/timefold/solver/core/impl/domain/solution/cloner/AbstractSolutionClonerTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Update this method so that its implementation is not identical to "assertEntityClone" on line 431.

See more on https://sonarcloud.io/project/issues?id=ai.timefold%3Atimefold-solver&issues=AaGwmkxrjTunXut1hZj7&open=AaGwmkxrjTunXut1hZj7&pullRequest=2806
String entityCode, String valueCode) {
assertThat(cloneEntity).isNotSameAs(originalEntity);
assertCode(entityCode, originalEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import ai.timefold.solver.core.testdomain.shadow.concurrent.TestdataConcurrentValue;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseEntity;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseGroup;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseOwner;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseSolution;
import ai.timefold.solver.core.testdomain.shadow.dependency.TestdataDependencyEntity;
import ai.timefold.solver.core.testdomain.shadow.dependency.TestdataDependencySimpleSolution;
Expand Down Expand Up @@ -420,7 +419,7 @@ void basicVariableStateSurvivesWorkingSolutionResets() {
// so a state which is not reused would accumulate one stale handler per reset.
var solutionDescriptor = SolutionDescriptor.buildSolutionDescriptor(TestdataBasicInverseSolution.class,
TestdataBasicInverseEntity.class, TestdataBasicInverseGroup.class);
var owner = new TestdataBasicInverseOwner("o1");
var owner = new TestdataValue("o1");
var group = new TestdataBasicInverseGroup("g1");
group.setOwner(owner);
var entity = new TestdataBasicInverseEntity("e1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import ai.timefold.solver.core.preview.api.domain.metamodel.PlanningSolutionMetaModel;
import ai.timefold.solver.core.preview.api.move.builtin.Moves;
import ai.timefold.solver.core.preview.api.move.test.MoveTester;
import ai.timefold.solver.core.testdomain.TestdataValue;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseEntity;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseGroup;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseOwner;
import ai.timefold.solver.core.testdomain.shadow.declarative.basicinverse.TestdataBasicInverseSolution;

import org.junit.jupiter.api.Test;
Expand All @@ -25,8 +25,8 @@ class BasicInverseShadowVariableTest {

@Test
void declarativeShadowTracksBasicVariableChangeThroughNonExternalizedInverseSupply() {
var ownerX = new TestdataBasicInverseOwner("ownerX");
var ownerY = new TestdataBasicInverseOwner("ownerY");
var ownerX = new TestdataValue("ownerX");
var ownerY = new TestdataValue("ownerY");

var groupA = new TestdataBasicInverseGroup("groupA");
groupA.setOwner(ownerX);
Expand All @@ -44,7 +44,7 @@ void declarativeShadowTracksBasicVariableChangeThroughNonExternalizedInverseSupp
var groupVariable = solutionMetaModel.genuineEntity(TestdataBasicInverseEntity.class)
.basicVariable("group", TestdataBasicInverseGroup.class);
var ownerVariable = solutionMetaModel.genuineEntity(TestdataBasicInverseGroup.class)
.basicVariable("owner", TestdataBasicInverseOwner.class);
.basicVariable("owner", TestdataValue.class);

var context = MoveTester.build(solutionMetaModel).using(solution);
assertThat(entity.getOwnerCode()).isEqualTo("ownerX");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import ai.timefold.solver.core.config.solver.EnvironmentMode;
import ai.timefold.solver.core.config.solver.SolverConfig;
import ai.timefold.solver.core.config.solver.termination.TerminationConfig;
import ai.timefold.solver.core.testdomain.shadow.method_variables.TestdataDeclarativeMethodVariablesBaseValue;
import ai.timefold.solver.core.testdomain.shadow.method_variables.TestdataDeclarativeMethodVariablesConstraintProvider;
import ai.timefold.solver.core.testdomain.shadow.extended.TestdataDeclarativeExtendedBaseValue;
import ai.timefold.solver.core.testdomain.shadow.extended.TestdataDeclarativeExtendedConstraintProvider;
import ai.timefold.solver.core.testdomain.shadow.extended.TestdataDeclarativeExtendedSubclassValue;
import ai.timefold.solver.core.testdomain.shadow.method_variables.TestdataDeclarativeMethodVariablesEntity;
import ai.timefold.solver.core.testdomain.shadow.method_variables.TestdataDeclarativeMethodVariablesSolution;
import ai.timefold.solver.core.testdomain.shadow.method_variables.TestdataDeclarativeMethodVariablesSubclassValue;

import org.junit.jupiter.api.Test;

Expand All @@ -25,9 +25,9 @@ void methodDefinedVariables() {
.withEnvironmentMode(EnvironmentMode.TRACKED_FULL_ASSERT)
.withSolutionClass(TestdataDeclarativeMethodVariablesSolution.class)
.withEntityClasses(TestdataDeclarativeMethodVariablesEntity.class,
TestdataDeclarativeMethodVariablesBaseValue.class,
TestdataDeclarativeMethodVariablesSubclassValue.class)
.withConstraintProviderClass(TestdataDeclarativeMethodVariablesConstraintProvider.class)
TestdataDeclarativeExtendedBaseValue.class,
TestdataDeclarativeExtendedSubclassValue.class)
.withConstraintProviderClass(TestdataDeclarativeExtendedConstraintProvider.class)
.withTerminationConfig(new TerminationConfig()
.withScoreCalculationCountLimit(1000L));

Expand All @@ -38,9 +38,9 @@ void methodDefinedVariables() {
var entityA = new TestdataDeclarativeMethodVariablesEntity("A");
var entityB = new TestdataDeclarativeMethodVariablesEntity("B");

var value1 = new TestdataDeclarativeMethodVariablesSubclassValue("1");
var value2 = new TestdataDeclarativeMethodVariablesSubclassValue("2");
var value31 = new TestdataDeclarativeMethodVariablesSubclassValue("31");
var value1 = new TestdataDeclarativeExtendedSubclassValue("1");
var value2 = new TestdataDeclarativeExtendedSubclassValue("2");
var value31 = new TestdataDeclarativeExtendedSubclassValue("31");

problem.setEntities(List.of(entityA, entityB));
problem.setValues(List.of(value1, value2, value31));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import ai.timefold.solver.core.preview.api.move.builtin.Moves;
import ai.timefold.solver.core.preview.api.move.test.MoveTester;
import ai.timefold.solver.core.testdomain.TestdataValue;
import ai.timefold.solver.core.testdomain.shadow.dynamic_follower.TestdataDynamicFollowerConstraintProvider;
import ai.timefold.solver.core.testdomain.shadow.dynamic_follower.TestdataDynamicFollowerEntity;
import ai.timefold.solver.core.testdomain.shadow.dynamic_follower.TestdataDynamicFollowerSolution;
import ai.timefold.solver.core.testdomain.shadow.dynamic_follower.TestdataDynamicLeaderEntity;
import ai.timefold.solver.core.testdomain.shadow.follower.TestdataFollowerConstraintProvider;
import ai.timefold.solver.core.testdomain.shadow.follower.TestdataLeaderEntity;

import org.junit.jupiter.api.Test;

Expand All @@ -25,8 +25,8 @@ void testSolve() {

var solverConfig = new SolverConfig()
.withSolutionClass(TestdataDynamicFollowerSolution.class)
.withEntityClasses(TestdataDynamicLeaderEntity.class, TestdataDynamicFollowerEntity.class)
.withConstraintProviderClass(TestdataDynamicFollowerConstraintProvider.class)
.withEntityClasses(TestdataLeaderEntity.class, TestdataDynamicFollowerEntity.class)
.withConstraintProviderClass(TestdataFollowerConstraintProvider.class)
.withEnvironmentMode(EnvironmentMode.FULL_ASSERT)
.withTerminationConfig(new TerminationConfig()
.withMoveCountLimit(1_000L));
Expand All @@ -42,8 +42,8 @@ void testSolve() {

@Test
void testLeaderValueChangeMove() {
var leaderA = new TestdataDynamicLeaderEntity("Leader A");
var leaderB = new TestdataDynamicLeaderEntity("Leader B");
var leaderA = new TestdataLeaderEntity("Leader A");
var leaderB = new TestdataLeaderEntity("Leader B");

var follower1 = new TestdataDynamicFollowerEntity("Follower 1", leaderA);
var follower2 = new TestdataDynamicFollowerEntity("Follower 2", leaderA);
Expand All @@ -58,7 +58,7 @@ void testLeaderValueChangeMove() {
List.of(value1, value2));

var solutionMetamodel = TestdataDynamicFollowerSolution.buildMetaModel();
var variableMetamodel = solutionMetamodel.genuineEntity(TestdataDynamicLeaderEntity.class)
var variableMetamodel = solutionMetamodel.genuineEntity(TestdataLeaderEntity.class)
.basicVariable("value", TestdataValue.class);

var context = MoveTester.build(solutionMetamodel)
Expand All @@ -81,8 +81,8 @@ void testLeaderValueChangeMove() {

@Test
void testLeaderChangeMove() {
var leaderA = new TestdataDynamicLeaderEntity("Leader A");
var leaderB = new TestdataDynamicLeaderEntity("Leader B");
var leaderA = new TestdataLeaderEntity("Leader A");
var leaderB = new TestdataLeaderEntity("Leader B");

var follower1 = new TestdataDynamicFollowerEntity("Follower 1", leaderA);
var follower2 = new TestdataDynamicFollowerEntity("Follower 2", leaderA);
Expand All @@ -105,7 +105,7 @@ void testLeaderChangeMove() {

var solutionMetamodel = TestdataDynamicFollowerSolution.buildMetaModel();
var variableMetamodel = solutionMetamodel.genuineEntity(TestdataDynamicFollowerEntity.class)
.basicVariable("leader", TestdataDynamicLeaderEntity.class);
.basicVariable("leader", TestdataLeaderEntity.class);

var context = MoveTester.build(solutionMetamodel)
.using(solution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import ai.timefold.solver.core.api.score.stream.Constraint;
import ai.timefold.solver.core.impl.domain.solution.descriptor.SolutionDescriptor;
import ai.timefold.solver.core.impl.score.constraint.ConstraintMatchPolicy;
import ai.timefold.solver.core.testdomain.score.TestdataSimpleScoreSolution;
import ai.timefold.solver.core.testdomain.TestdataSolution;

import org.junit.jupiter.api.Test;

class SimpleScoreInlinerTest extends AbstractScoreInlinerTest<TestdataSimpleScoreSolution, SimpleScore> {
class SimpleScoreInlinerTest extends AbstractScoreInlinerTest<TestdataSolution, SimpleScore> {

@Test
void defaultScore() {
Expand Down Expand Up @@ -63,8 +63,8 @@ void impactTotalOverflow() {
}

@Override
protected SolutionDescriptor<TestdataSimpleScoreSolution> buildSolutionDescriptor() {
return TestdataSimpleScoreSolution.buildSolutionDescriptor();
protected SolutionDescriptor<TestdataSolution> buildSolutionDescriptor() {
return TestdataSolution.buildSolutionDescriptor();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
import ai.timefold.solver.core.testdomain.list.valuerange.unassignedvar.sortedset.TestdataListUnassignedEntityProvidingSortedSetSolution;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedEntityEasyScoreCalculator;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedMultiEntityFirstEntity;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedMultiEntityFirstValue;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedMultiEntitySecondEntity;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedMultiEntitySecondValue;
import ai.timefold.solver.core.testdomain.mixed.multientity.TestdataMixedMultiEntitySolution;
Expand Down Expand Up @@ -2813,9 +2812,9 @@ void failMixedModelInvalidValueRange() {
.withEasyScoreCalculatorClass(DummySimpleScoreEasyScoreCalculator.class);

var problem = new TestdataMixedMultiEntitySolution();
var v1a = new TestdataMixedMultiEntityFirstValue("1");
var v2a = new TestdataMixedMultiEntityFirstValue("2");
var v3a = new TestdataMixedMultiEntityFirstValue("3");
var v1a = new TestdataValue("1");
var v2a = new TestdataValue("2");
var v3a = new TestdataValue("3");
var v1b = new TestdataMixedMultiEntitySecondValue("1", 1);
var v2b = new TestdataMixedMultiEntitySecondValue("2", 1);
var v3b = new TestdataMixedMultiEntitySecondValue("3", 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import ai.timefold.solver.core.testdomain.valuerange.entityproviding.TestdataEntityProvidingSolution;
import ai.timefold.solver.core.testdomain.valuerange.entityproviding.unassignedvar.TestdataAllowsUnassignedEntityProvidingEntity;
import ai.timefold.solver.core.testdomain.valuerange.entityproviding.unassignedvar.TestdataAllowsUnassignedEntityProvidingSolution;
import ai.timefold.solver.core.testdomain.valuerange.incomplete.TestdataIncompleteValueRangeEntity;
import ai.timefold.solver.core.testdomain.valuerange.incomplete.TestdataIncompleteValueRangeSolution;

import org.jspecify.annotations.NullMarked;
Expand Down Expand Up @@ -53,7 +52,7 @@ void fromSolution() {
@Test
void fromSolutionIncompleteValueRange() {
var solutionMetaModel = TestdataIncompleteValueRangeSolution.buildMetaModel();
var variableMetaModel = solutionMetaModel.genuineEntity(TestdataIncompleteValueRangeEntity.class)
var variableMetaModel = solutionMetaModel.genuineEntity(TestdataEntity.class)
.basicVariable();

// The point of this test is to ensure that the move provider skips values that are not in the value range.
Expand Down

This file was deleted.

Loading
Loading