AbstractOptimizer implements Optimizer { @Override public void addOptimizerIterationListener(OptimizerIterationListener listener) { iterationListeners.add(listener); } AbstractOptimizer(Population population, Archive archive, IndividualCompleter completer, Control control,
			Iteration iteration); @Override int getIteration(); @Override boolean isRunning(); @Override void startOptimization(); @Override void stopOptimization(); @Override void addOptimizerIterationListener(OptimizerIterationListener listener); @Override void addOptimizerStateListener(OptimizerStateListener listener); @Override void removeOptimizerIterationListener(OptimizerIterationListener listener); @Override void removeOptimizerStateListener(OptimizerStateListener listener);  }
@Test public void addOptimizerIterationListener() { final MockOptimizer optimizer = new MockOptimizer(null, null, null, null, null); OptimizerIterationListener l = (int iteration) -> { }; optimizer.addOptimizerIterationListener(l); Assert.assertEquals(1, optimizer.iterationListeners.size()); Assert.assertSame(l, optimizer.iterationListeners.iterator().next()); }