Design of genetic algorithm which would allow TDD I'm implementing genetic algorithm in Java and I want to learn TDD with this project.

Currently I have this code:

package geneticAlgoritm;

import geneticAlgoritm.randomNumbers.IRandomGenerator;
import geneticAlgoritm.randomNumbers.RandomGenerator;
import lombok.Getter;
import lombok.NonNull;

import java.util.List; 

public class Population {
    @NonNull private IRandomGenerator generator = new RandomGenerator();

    @Getter
    @NonNull
    private List&lt;Chromosome&gt; population;

    @NonNull final IFitnessCalculator calculator;

    public Population(int n, IFitnessCalculator calculator) {
        this.calculator = calculator;
        this.population = generatePopulation(n);
    }

    int nextGeneration() {

    }

    private List&lt;Chromosome&gt; generatePopulation(int n) {
        return null;
    }

    private Chromosome mutate(Chromosome chromosome, double probability) {
        return null;
    }

    private Chromosome crossover(Chromosome first, Chromosome second, double probability) {
        return null;
    }

    private List&lt;Chromosome&gt; pickBestOfPopulation(int n) {
        return null;
    }
}


Basically, I have Chromosome class, which is wrapper for byte[] array and fitness of that array.

nextGeneration generates new population with better traits. How I can change design to allow testing crossover, mutate etc functions? 

nextGeneration is really inconvenient to test for all functionalities, especially with some randomness in each (I'm using custom interface to remove it).
You have already written the API of your implementation. Being strict: That's not how tdd works. 


Write one failing test
Make the test pass
Refactor


Your test case should not only test your implementation, but also document the behaviour of your implementation - without having written the implementation. And if you're at the first point, your test case describes the expected behaviour of your implementation. And it guides the design of your implementation.

And what's very important, too: Know when to stop. If you have code which is not covered by your test cases - and should be covered by a test case - at the end of an iteration, you did it wrong.

And in my opinion: A code review does help, but not too much. Because with tdd, an application grows iteration by iteration. And the thoughts which have to be thought during those steps have to be learned and practiced.