@Test
public void nextIteration() throws TerminationException {

	final Control c = new Control();
	Population p = new Population();
	final Individual i1 = new MockIndividual();
	p.add(i1);
	Archive a = new Archive() {
		@Override
		public boolean update(Set<? extends Individual> individuals) {
			archiveHasRun = true;
			Assert.assertTrue(individuals.contains(i1));
			return true;
		}
	};
	IndividualCompleter completer = new IndividualCompleter() {
		@Override
		public void complete(Individual... individuals) throws TerminationException {
			complete(Arrays.asList(individuals));
		}
		@Override
		public void complete(Iterable<? extends Individual> iterable) throws TerminationException {
			completerHasRun = true;
			Assert.assertTrue(iterable.iterator().hasNext());
			Assert.assertSame(i1, iterable.iterator().next());
		}
	};
	final MockOptimizer optimizer = new MockOptimizer(p, a, completer, c, new Iteration(10));
	Assert.assertFalse(optimizer.isRunning());
	optimizer.setOptimizeTest(new TestMethod() {
		@Override
		public void test() throws TerminationException, StopException {
			c.doStop();
			c.checkpoint();
			optimizer.nextIteration();
		}
	});
	optimizer.startOptimization();
	Assert.assertFalse(optimizer.isRunning());
	Assert.assertTrue(archiveHasRun);
	Assert.assertTrue(completerHasRun);
}