TournamentSelect extends SelectionOperation implements Stochastic { public void selectFromTour() { Collections.sort(tour); this.selectedPopulation.add(tour.get(0).getIndividual().clone()); } TournamentSelect(int size, int tourSize, RandomNumberGenerator rand);  TournamentSelect(RandomNumberGenerator rand, Properties p);  TournamentSelect(); void setProperties(Properties p); void doOperation(Individual operand); void doOperation(List<Individual> operands); void getTour(List<Individual> operands); void selectFromTour(); void setRNG(RandomNumberGenerator m); RandomNumberGenerator getRNG();  }
@Test public void testSelectFromTour() { System.out.println("* TournamentSelect: selectFromTour"); TournamentSelect instance = new TournamentSelect(2,2,new MersenneTwisterFast(0)); instance.getTour(operands); instance.selectFromTour(); assertEquals(instance.getSelectedPopulation().size(), 1); assertEquals(instance.getSelectedPopulation().get(0).getFitness().getDouble(), 1.0, 0.001); assertNotSame(instance.getSelectedPopulation().get(0),operands.get(9)); }