@Test
public void testIterator() {

	int insertSize = 17;
	int boundSize = 5;
	Integer defaultElement = 4711;
	EvictingBoundedList<Integer> list = new EvictingBoundedList<>(boundSize, defaultElement);
	assertTrue(list.isEmpty());
	for (int i = 0; i < insertSize; ++i) {
		list.add(i);
	}
	Iterator<Integer> iterator = list.iterator();
	for (int i = 0; i < insertSize; ++i) {
		assertTrue(iterator.hasNext());
		int exp = i < (insertSize - boundSize) ? defaultElement : i;
		int act = iterator.next();
		assertEquals(exp, act);
	}
	assertFalse(iterator.hasNext());
	try {
		iterator.next();
		fail("Next on exhausted iterator did not trigger exception.");
	} catch (NoSuchElementException ignored) {
	}
	iterator = list.iterator();
	assertTrue(iterator.hasNext());
	iterator.next();
	list.add(123);
	assertTrue(iterator.hasNext());
	try {
		iterator.next();
		fail("Concurrent modification not detected.");
	} catch (ConcurrentModificationException ignored) {
	}
}