SimplePopulation implements Population { @Override public String toString() { final StringBuffer s = new StringBuffer(); final Iterator<Individual> iIt = indies.iterator(); DecimalFormat df = new DecimalFormat("#0.00"); while (iIt.hasNext()) { final Individual ind = iIt.next(); final String f = df.format(ind.getFitness().getDouble()); s.append(f); if(iIt.hasNext()) { s.append(","); } } return s.toString(); } SimplePopulation();  SimplePopulation(int size); void add(Individual i); void sort(); Iterator<Individual> iterator(); int size(); void addAll(Collection<Individual> immigrants); void addAll(Population immigrants); List<Individual> getAll(); boolean contains(AbstractIndividual individual); @Override String toString(); boolean contains(Individual individual); Individual get(int index); void clear(); void remove(Individual ind); Individual set(int i, Individual ind);  }
@Test public void testToString() { System.out.println("*SimplePopulationTest: toString"); String expResult = "4.00,3.00,2.00,1.00"; String result = population.toString(); assertEquals(true, expResult.equals(result)); }