BasicFitness implements Fitness { public void setDouble(double f) { if(Double.isNaN(f) || Double.isInfinite(f)) { f = BasicFitness.Max_Double; } this.value = f; } BasicFitness();  BasicFitness(double f, Individual i);  BasicFitness(Individual i); int compareTo(Fitness o); double getMaxDoubleFitness(); void setMaxDoubleFitness(double d); double getMinDoubleFitness(); void setMinDoubleFitness(double d); int getMaxIntFitness(); void setMaxIntFitness(int d); int getMinIntFitness(); void setMinIntFitness(int d); void setDefault(); double getDefaultFitness(); double getDouble(); double getDistance(DoubleFitness f); Individual getIndividual(); void setIndividual(Individual i); void setDouble(double f); int getInt(); void setInt(int f); Object getData(); void setData(Object data); static final double DEFAULT_FITNESS; }
@Test public void testSetDouble() { System.out.println("*BaicFitnessTest: setDouble"); double f = Double.NaN; BasicFitness instance = new BasicFitness(); instance.setDouble(f); assertEquals(true, instance.getDouble()==instance.getMaxDoubleFitness()); f = Double.NEGATIVE_INFINITY; instance = new BasicFitness(); instance.setDouble(f); assertEquals(true, instance.getDouble() == instance.getMaxDoubleFitness()); }