DefaultSolverScope solverScope = mock(DefaultSolverScope.class);
when(solverScope.getWorkingRandom()).thenReturn(workingRandom);
moveSelector.solvingStarted(solverScope);
AbstractSolverPhaseScope phaseScopeA = mock(AbstractSolverPhaseScope.class);
when(phaseScopeA.getSolverScope()).thenReturn(solverScope);
when(phaseScopeA.getWorkingRandom()).thenReturn(workingRandom);
moveSelector.phaseStarted(phaseScopeA);
AbstractStepScope stepScopeA1 = mock(AbstractStepScope.class);
when(stepScopeA1.getPhaseScope()).thenReturn(phaseScopeA);
when(stepScopeA1.getWorkingRandom()).thenReturn(workingRandom);
when(workingRandom.nextInt(3)).thenReturn(2);
when(workingRandom.nextInt(2)).thenReturn(0);
moveSelector.stepStarted(stepScopeA1);
assertAllCodesOfEndingMoveSelector(moveSelector, "a2", "a1", "a3");
moveSelector.stepEnded(stepScopeA1);
AbstractStepScope stepScopeA2 = mock(AbstractStepScope.class);
when(stepScopeA2.getPhaseScope()).thenReturn(phaseScopeA);
when(stepScopeA2.getWorkingRandom()).thenReturn(workingRandom);
when(workingRandom.nextInt(3)).thenReturn(0);
when(workingRandom.nextInt(2)).thenReturn(1);
moveSelector.stepStarted(stepScopeA2);
if (cacheType.compareTo(SelectionCacheType.STEP) > 0) {
// From a1, a2, a3
assertAllCodesOfEndingMoveSelector(moveSelector, "a3", "a1", "a2");
} else {
// Reset from a1, a2, a3
assertAllCodesOfEndingMoveSelector(moveSelector, "a3", "a2", "a1");
}
moveSelector.stepEnded(stepScopeA2);
moveSelector.phaseEnded(phaseScopeA);
AbstractSolverPhaseScope phaseScopeB = mock(AbstractSolverPhaseScope.class);
when(phaseScopeB.getSolverScope()).thenReturn(solverScope);
when(phaseScopeB.getWorkingRandom()).thenReturn(workingRandom);
moveSelector.phaseStarted(phaseScopeB);
AbstractStepScope stepScopeB1 = mock(AbstractStepScope.class);
when(stepScopeB1.getPhaseScope()).thenReturn(phaseScopeB);
when(stepScopeB1.getWorkingRandom()).thenReturn(workingRandom);