TournamentSelect extends SelectionOperation implements Stochastic { public void getTour(List<Individual> operands) { tour.clear(); int contestant; for(int i = 0;i<this.tournamentSize;i++) { contestant = this.rng.nextInt(operands.size()); tour.add(operands.get(contestant).getFitness()); } } 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 testGetTour() { System.out.println("* TournamentSelect: getTour"); TournamentSelect instance = new TournamentSelect(2,2,new MersenneTwisterFast(0)); instance.getTour(operands); assertEquals(instance.tour.size(), 2); assertEquals(instance.tour.get(0).getDouble(),8.0,0.001); assertEquals(instance.tour.get(1).getDouble(), 1.0, 0.001); assertSame(instance.tour.get(0),operands.get(2).getFitness()); assertSame(instance.tour.get(1),operands.get(9).getFitness()); }