### Question:
DefaultObjective extends ErrorBasedObjective { @Override public double apply(final Chromosome<Double> c) { List<Map<Integer, Double>> results = c.evaluate(getDataManager()); List<Double> summedResults = new ArrayList<>(results.size()); results.forEach(result -> summedResults.add( result.values().stream().mapToDouble(i -> i).sum() )); double fitness = getLambda().apply(summedResults, getExpectedResults()); if (Double.isNaN(fitness)) { fitness = getWorstValue(); } c.setFitness(fitness); return fitness; } DefaultObjective(final ErrorFunction lambda, final DataManager<Double> dataManager); @Override double apply(final Chromosome<Double> c);  }### Answer:
@Test void testApply() { final double expected = 7.5; final double fitness = defaultObjective.apply(chromosome); assertEquals(expected, fitness); }