public void testIterator() { ListIterator iter = (ListIterator) makeObject(); assertTrue( "Iterator should have next item", iter.hasNext() ); assertTrue( "Iterator should have no previous item", !iter.hasPrevious() ); assertEquals( "Iteration next index", 0, iter.nextIndex() ); assertEquals( "Iteration previous index", -1, iter.previousIndex() ); assertTrue( "Iterator should have no next item", !iter.hasNext() ); assertTrue( "Iterator should have previous item", iter.hasPrevious() ); assertEquals( "Iteration next index", 1, iter.nextIndex() ); assertEquals( "Iteration previous index", 0, iter.previousIndex() ); assertTrue( "Iterator should have next item", iter.hasNext() ); assertTrue( "Iterator should have no previous item", !iter.hasPrevious() ); assertEquals( "Iteration next index", 0, iter.nextIndex() ); assertEquals( "Iteration previous index", -1, iter.previousIndex() ); assertTrue( "Iterator should have no next item", !iter.hasNext() ); assertTrue( "Iterator should have previous item", iter.hasPrevious() ); assertEquals( "Iteration next index", 1, iter.nextIndex() ); assertEquals( "Iteration previous index", 0, iter.previousIndex() ); iter.next(); } catch (Exception e) { assertTrue("NoSuchElementException must be thrown", e.getClass().equals((new NoSuchElementException()).getClass())); iter.previous(); } catch (Exception e) { assertTrue("NoSuchElementException must be thrown",