RouletteWheel extends SelectionOperation implements Stochastic { protected void calculateFitnessSum(List<Individual> c) { double sum = 0; double tmp; Iterator<Individual> itI = c.iterator(); this.minFit = Double.MAX_VALUE; while(itI.hasNext()) { tmp = itI.next().getFitness().getDouble(); if (tmp > 1) { this.smallFit = false; } sum += tmp; if(this.minFit < tmp) { this.minFit = tmp; } } this.sumFit = sum; } RouletteWheel(int size, RandomNumberGenerator rng);  RouletteWheel(); @Override void setProperties(Properties p); @Override void doOperation(Individual operand); void doOperation(List<Individual> operands); void rankPopulation(List<Individual> operands); RandomNumberGenerator getRNG(); void setRNG(RandomNumberGenerator m);  }
@Test public void testCalculateFitnessSum() { System.out.println("calculateFitnessSum"); RouletteWheel instance = new RouletteWheelMock(); instance.calculateFitnessSum(individuals); assertEquals(instance.sumFit, 30, 9e-16); }