Source:
public void shadowVariableCorruption() { EasyScoreDirectorFactory<TestdataCorruptedShadowedSolution> scoreDirectorFactory = new EasyScoreDirectorFactory<>((EasyScoreCalculator<TestdataCorruptedShadowedSolution>) (solution_) -> SimpleScore.valueOf(0)); scoreDirectorFactory.setSolutionDescriptor(TestdataCorruptedShadowedSolution.buildSolutionDescriptor()); scoreDirectorFactory.setInitializingScoreTrend( InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 1)); EasyScoreDirector<TestdataCorruptedShadowedSolution> scoreDirector = scoreDirectorFactory.buildScoreDirector(false, false); TestdataCorruptedShadowedSolution solution = new TestdataCorruptedShadowedSolution("s1"); TestdataValue v1 = new TestdataValue("v1"); TestdataValue v2 = new TestdataValue("v2"); solution.setValueList(Arrays.asList(v1, v2)); TestdataCorruptedShadowedEntity e1 = new TestdataCorruptedShadowedEntity("e1"); TestdataCorruptedShadowedEntity e2 = new TestdataCorruptedShadowedEntity("e2"); solution.setEntityList(Arrays.asList(e1, e2)); scoreDirector.setWorkingSolution(solution); scoreDirector.assertShadowVariablesAreNotStale(SimpleScore.valueOfUninitialized(-2, 0), "NoChange"); scoreDirector.beforeVariableChanged(e1, "value"); e1.setValue(v1); scoreDirector.afterVariableChanged(e1, "value"); scoreDirector.beforeVariableChanged(e2, "value"); e2.setValue(v1); scoreDirector.afterVariableChanged(e2, "value"); scoreDirector.triggerVariableListeners(); scoreDirector.assertShadowVariablesAreNotStale(SimpleScore.valueOfUninitialized(0, 0), "FirstChange"); }

Target:
public void shadowVariableCorruption() { EasyScoreDirectorFactory<TestdataCorruptedShadowedSolution> scoreDirectorFactory = new EasyScoreDirectorFactory<>((EasyScoreCalculator<TestdataCorruptedShadowedSolution>) (solution_) -> SimpleScore.valueOf(0)); scoreDirectorFactory.setSolutionDescriptor(TestdataCorruptedShadowedSolution.buildSolutionDescriptor()); scoreDirectorFactory.setInitializingScoreTrend( InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 1)); EasyScoreDirector<TestdataCorruptedShadowedSolution> scoreDirector = scoreDirectorFactory.buildScoreDirector(false, false); TestdataCorruptedShadowedSolution solution = new TestdataCorruptedShadowedSolution("s1"); TestdataValue v1 = new TestdataValue("v1"); TestdataValue v2 = new TestdataValue("v2"); solution.setValueList(Arrays.asList(v1, v2)); TestdataCorruptedShadowedEntity e1 = new TestdataCorruptedShadowedEntity("e1"); TestdataCorruptedShadowedEntity e2 = new TestdataCorruptedShadowedEntity("e2"); solution.setEntityList(Arrays.asList(e1, e2)); scoreDirector.setWorkingSolution(solution); scoreDirector.assertShadowVariablesAreNotStale(SimpleScore.valueOfUninitialized(-2, 0), "NoChange"); scoreDirector.beforeVariableChanged(e1, "value"); e1.setValue(v1); scoreDirector.afterVariableChanged(e1, "value"); scoreDirector.beforeVariableChanged(e2, "value"); e2.setValue(v1); scoreDirector.afterVariableChanged(e2, "value"); scoreDirector.triggerVariableListeners(); try { scoreDirector.assertShadowVariablesAreNotStale(SimpleScore.valueOfUninitialized(0, 0), "FirstChange"); fail("IllegalStateException wasn't thrown."); } catch (IllegalStateException e) { } }