Source:
<code>public void testMultipleDataTypes() { final RandomOptimizer randomOptimizer = getRandomOptimizer(1.0, 1.0); final List<EvaluatorParameters> evaluators = new ArrayList<>(); final List<DataInfo> dataInfo1 = new ArrayList<>(); dataInfo1.add(new DataInfoImpl("dataTypeB", 300)); evaluators.add(new EvaluatorParametersImpl("1", dataInfo1)); final List<DataInfo> dataInfo2 = new ArrayList<>(); dataInfo2.add(new DataInfoImpl("dataTypeA", 1000)); dataInfo2.add(new DataInfoImpl("dataTypeB", 500)); evaluators.add(new EvaluatorParametersImpl("2", dataInfo2)); final Plan sameNumEvaluatorsPlan = randomOptimizer.optimize(evaluators, evaluators.size()); assertEquals(0, sameNumEvaluatorsPlan.getEvaluatorsToAdd().size()); assertEquals(0, sameNumEvaluatorsPlan.getEvaluatorsToDelete().size()); final Plan singleEvaluatorPlan = randomOptimizer.optimize(evaluators, 1); assertEquals(0, singleEvaluatorPlan.getEvaluatorsToAdd().size()); assertEquals(1, singleEvaluatorPlan.getEvaluatorsToDelete().size()); final String evaluatorToDelete = singleEvaluatorPlan.getEvaluatorsToDelete().iterator().next(); <START> if ("1".equals(evaluatorToDelete)) { <END> assertEquals(1, singleEvaluatorPlan.getTransferSteps().size()); final TransferStep transferStep = singleEvaluatorPlan.getTransferSteps().iterator().next(); assertEquals("1", transferStep.getSrcId()); assertEquals("2", transferStep.getDstId()); assertEquals("dataTypeB", transferStep.getDataInfo().getDataType()); assertEquals(300, transferStep.getDataInfo().getNumUnits()); } else if ("2".equals(evaluatorToDelete)) { assertEquals(2, singleEvaluatorPlan.getTransferSteps().size()); long sum = 0; for (final TransferStep transferStep : singleEvaluatorPlan.getTransferSteps()) { assertEquals("2", transferStep.getSrcId()); assertEquals("1", transferStep.getDstId()); sum += transferStep.getDataInfo().getNumUnits(); } assertEquals(1000 + 500, sum); } else { fail("Unknown evaluatorToDelete " + evaluatorToDelete); } }</code><technical_language>this condition true? implementation of RandomOptimizer, evaluators get deleted starting tail of input list, which, in this case, is evaluator "2"</technical_language>

Target:
public void testMultipleDataTypes() { final RandomOptimizer randomOptimizer = getRandomOptimizer(1.0, 1.0); final List<EvaluatorParameters> evaluators = new ArrayList<>(); final List<DataInfo> dataInfo1 = new ArrayList<>(); dataInfo1.add(new DataInfoImpl("dataTypeB", 300)); evaluators.add(new EvaluatorParametersImpl("1", dataInfo1)); final List<DataInfo> dataInfo2 = new ArrayList<>(); dataInfo2.add(new DataInfoImpl("dataTypeA", 1000)); dataInfo2.add(new DataInfoImpl("dataTypeB", 500)); evaluators.add(new EvaluatorParametersImpl("2", dataInfo2)); final Plan sameNumEvaluatorsPlan = randomOptimizer.optimize(evaluators, evaluators.size()); assertEquals(0, sameNumEvaluatorsPlan.getEvaluatorsToAdd().size()); assertEquals(0, sameNumEvaluatorsPlan.getEvaluatorsToDelete().size()); final Plan singleEvaluatorPlan = randomOptimizer.optimize(evaluators, 1); assertEquals(0, singleEvaluatorPlan.getEvaluatorsToAdd().size()); assertEquals(1, singleEvaluatorPlan.getEvaluatorsToDelete().size()); final String evaluatorToDelete = singleEvaluatorPlan.getEvaluatorsToDelete().iterator().next(); assertEquals("2", evaluatorToDelete); assertEquals(2, singleEvaluatorPlan.getTransferSteps().size()); long sum = 0; for (final TransferStep transferStep : singleEvaluatorPlan.getTransferSteps()) { assertEquals("2", transferStep.getSrcId()); assertEquals("1", transferStep.getDstId()); sum += transferStep.getDataInfo().getNumUnits(); } assertEquals(1000 + 500, sum); }