FitnessThresholdLimit implements Predicate<EvolutionResult<?, C>> { @Override public boolean test(final EvolutionResult<?, C> result) { final boolean proceed = _proceed && result.optimize().compare(_threshold, result.bestFitness()) >= 0; try { return _proceed; } finally { _proceed = proceed; } } FitnessThresholdLimit(final C threshold); @Override boolean test(final EvolutionResult<?, C> result);  }
@Test(dataProvider = "testData") public void testMaximum( final Double threshold, final Integer min, final Integer max, final Optimize opt, final Boolean result ) { final FitnessThresholdLimit<Double> limit = new FitnessThresholdLimit<>(threshold); limit.test(result(min, max, opt)); Assert.assertEquals( limit.test(result(min, max, opt)), result.booleanValue() ); }