FromSolutionEntitySelector entitySelector = new FromSolutionEntitySelector(entityDescriptor, SelectionCacheType.JUST_IN_TIME, false);
DefaultSolverScope solverScope = mock(DefaultSolverScope.class);
entitySelector.solvingStarted(solverScope);
AbstractPhaseScope phaseScopeA = mock(AbstractPhaseScope.class);
when(phaseScopeA.getSolverScope()).thenReturn(solverScope);
when(phaseScopeA.getScoreDirector()).thenReturn(scoreDirector);
entitySelector.phaseStarted(phaseScopeA);
AbstractStepScope stepScopeA1 = mock(AbstractStepScope.class);
when(stepScopeA1.getPhaseScope()).thenReturn(phaseScopeA);
when(stepScopeA1.getScoreDirector()).thenReturn(scoreDirector);
entitySelector.stepStarted(stepScopeA1);
assertAllCodesOfEntitySelector(entitySelector, "e1", "e2", "e3");
entitySelector.stepEnded(stepScopeA1);
when(entityDescriptor.extractEntities(workingSolution)).thenReturn(Arrays.<Object>asList(
new TestdataEntity("f1"), new TestdataEntity("f2"), new TestdataEntity("f3")));
when(scoreDirector.getWorkingEntityListRevision()).thenReturn(8L);
when(scoreDirector.isWorkingEntityListDirty(7L)).thenReturn(true);
when(scoreDirector.isWorkingEntityListDirty(8L)).thenReturn(false);
AbstractStepScope stepScopeA2 = mock(AbstractStepScope.class);
when(stepScopeA2.getPhaseScope()).thenReturn(phaseScopeA);
when(stepScopeA2.getScoreDirector()).thenReturn(scoreDirector);
entitySelector.stepStarted(stepScopeA2);
assertAllCodesOfEntitySelector(entitySelector, "f1", "f2", "f3");
entitySelector.stepEnded(stepScopeA2);
entitySelector.phaseEnded(phaseScopeA);
AbstractPhaseScope phaseScopeB = mock(AbstractPhaseScope.class);
when(phaseScopeB.getSolverScope()).thenReturn(solverScope);
when(phaseScopeB.getScoreDirector()).thenReturn(scoreDirector);
entitySelector.phaseStarted(phaseScopeB);
AbstractStepScope stepScopeB1 = mock(AbstractStepScope.class);
when(stepScopeB1.getPhaseScope()).thenReturn(phaseScopeB);
when(stepScopeB1.getScoreDirector()).thenReturn(scoreDirector);