public void original() {
GenuineVariableDescriptor variableDescriptor = TestdataChainedEntity.buildVariableDescriptorForChainedObject();
InnerScoreDirector scoreDirector = mock(InnerScoreDirector.class);
TestdataChainedAnchor a0 = new TestdataChainedAnchor("a0");
TestdataChainedEntity a1 = new TestdataChainedEntity("a1", a0);
TestdataChainedEntity a2 = new TestdataChainedEntity("a2", a1);
TestdataChainedEntity a3 = new TestdataChainedEntity("a3", a2);
TestdataChainedEntity a4 = new TestdataChainedEntity("a4", a3);
TestdataChainedAnchor b0 = new TestdataChainedAnchor("b0");
TestdataChainedEntity b1 = new TestdataChainedEntity("b1", b0);
TestdataChainedEntity b2 = new TestdataChainedEntity("b2", b1);
SelectorTestUtils.mockMethodGetTrailingEntity(scoreDirector, variableDescriptor,
new TestdataChainedEntity[]{a1, a2, a3, a4, b1, b2});
EntityIndependentValueSelector valueSelector = SelectorTestUtils.mockEntityIndependentValueSelector(
variableDescriptor,
a0, a1, a2, a3, a4, b0, b1, b2);
DefaultSubChainSelector subChainSelector = new DefaultSubChainSelector(
valueSelector, false, 1, Integer.MAX_VALUE);
DefaultSolverScope solverScope = mock(DefaultSolverScope.class);
when(solverScope.getScoreDirector()).thenReturn(scoreDirector);
subChainSelector.solvingStarted(solverScope);
AbstractPhaseScope phaseScopeA = mock(AbstractPhaseScope.class);
when(phaseScopeA.getSolverScope()).thenReturn(solverScope);
subChainSelector.phaseStarted(phaseScopeA);
AbstractStepScope stepScopeA1 = mock(AbstractStepScope.class);
when(stepScopeA1.getPhaseScope()).thenReturn(phaseScopeA);
subChainSelector.stepStarted(stepScopeA1);
assertAllCodesOfSubChainSelector(subChainSelector,
"[a1]", "[a1, a2]", "[a1, a2, a3]", "[a1, a2, a3, a4]",
"[a2]", "[a2, a3]", "[a2, a3, a4]",
"[a3]", "[a3, a4]",
"[a4]",
"[b1]", "[b1, b2]",
"[b2]");
subChainSelector.stepEnded(stepScopeA1);
a4.setChainedObject(a2);
a3.setChainedObject(b1);
b2.setChainedObject(a3);
AbstractStepScope stepScopeA2 = mock(AbstractStepScope.class);
when(stepScopeA2.getPhaseScope()).thenReturn(phaseScopeA);
subChainSelector.stepStarted(stepScopeA2);
assertAllCodesOfSubChainSelector(subChainSelector,