javatestinglinked-listiteratorlistiterator

How do you test that an Iterator/ListIterator works?


I have an implemenation of a single linked, linked list. I have written a ListIterator for this class. How can I test that my implementation for the ListIterator works? So far I have used a for-each loop on an instance of my linked list, which works. In what other ways do I need to test it?


Solution

  • Usually, you want to test all the edge cases in addition to the "normal" case. Maybe:

    etc..