@Test
// test if selects correct number and order of individuals; 2 populations at input and output
public void testSelect2() throws Exception{

    SimplePopulation popIn1 = new SimplePopulation();
    SimplePopulation popIn2 = new SimplePopulation();
    Individual[] individuals = new SimpleIndividual[5];
    for (int i = 0; i < individuals.length; i++){
        individuals[i] = new SimpleIndividual(0, 0.0, new SimplePhenotypeRepresentation());
        individuals[i].setFitness((i-1)*(i-1)); // shifted parabola with prescription y = x^2 and bottom at position (x = -1).
    }
    Individual[] ind1 = new Individual[]{individuals[0], individuals[2], individuals[4]};
    Individual[] ind2 = new Individual[]{individuals[1], individuals[3]};
    popIn1.setIndividuals(ind1);
    popIn2.setIndividuals(ind2);
    this.operator.setInputArity(2);
    this.operator.setOutputArity(2);
    this.operator.setIndividualsPerPopulation(2);
    Population[] popsOut = this.operator.select(new SimplePopulation[]{popIn1, popIn2});
    assertTrue(popsOut.length == 2);
    assertTrue(popsOut[0].getIndividuals().length == 2);
    assertTrue(popsOut[1].getIndividuals().length == 2);
    Individual indOut = popsOut[0].getIndividuals()[0];
    assertTrue(indOut.getFitness() == 9.0);
    indOut = popsOut[1].getIndividuals()[0];
    assertTrue(indOut.getFitness() == 4.0);
    indOut = popsOut[0].getIndividuals()[1];
    assertTrue(indOut.getFitness() == 1.0);
    indOut = popsOut[1].getIndividuals()[1];
    assertTrue(indOut.getFitness() == 1.0);
}