AbstractOptimizer implements Optimizer { @Override public void startOptimization() { optimizing = true; for (OptimizerStateListener listener : stateListeners) { listener.optimizationStarted(this); } try { optimize(); } catch (StopException e) { System.out.println("Optimization stopped."); } catch (TerminationException e) { System.err.println("Optimization terminated."); } finally { stopOptimization(); } } 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 startOptimization() throws TerminationException { final MockOptimizer optimizer = new MockOptimizer(null, null, null, null, null); Assert.assertFalse(optimizer.isRunning()); optimizer.setOptimizeTest(new TestMethod() { @Override public void test() throws TerminationException, StopException { Assert.assertTrue(optimizer.isRunning()); } }); optimizer.startOptimization(); Assert.assertFalse(optimizer.isRunning()); }