@Test
public void testGetIndexBehindIndividual() throws Exception {

    ParallelFunctionEvaluator evaluator = new ParallelFunctionEvaluator();
    Population[] populations = new Population[]{new SimplePopulation(new Individual[6]), new SimplePopulation(new Individual[4]), new SimplePopulation(new Individual[3])};
    ParallelFunctionEvaluator.PositionDescriptor descriptor = evaluator.getIndexBehindIndividual(populations, 0);
    assertEquals(0, descriptor.getPopulationIndex());
    assertEquals(1, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 6);
    assertEquals(1, descriptor.getPopulationIndex());
    assertEquals(1, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 1);
    assertEquals(0, descriptor.getPopulationIndex());
    assertEquals(2, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 5);
    assertEquals(0, descriptor.getPopulationIndex());
    assertEquals(6, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 9);
    assertEquals(1, descriptor.getPopulationIndex());
    assertEquals(4, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 10);
    assertEquals(2, descriptor.getPopulationIndex());
    assertEquals(1, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 12);
    assertEquals(2, descriptor.getPopulationIndex());
    assertEquals(3, descriptor.getIndividualIndex());
    descriptor = evaluator.getIndexBehindIndividual(populations, 13);
    assertEquals(2, descriptor.getPopulationIndex());
    assertEquals(3, descriptor.getIndividualIndex());
    // over-indexed, then return one position after the last individual
    descriptor = evaluator.getIndexBehindIndividual(populations, 14);
    assertEquals(2, descriptor.getPopulationIndex());
    assertEquals(3, descriptor.getIndividualIndex());
}