Test an Iterable ADTs
- Test an Iterable ADTs.
Let's add a simple test to the IndexedListTest to test the (inherited) IndexedList.iterator method:
@Test
@DisplayName("test iterator after IndexedList is instantiated.")
void testEnhancedLoopAfterConstruction() {
int counter = 0;
for(int element: numbers) {
assertEquals(defaultValue, element);
counter++;
}
assertEquals(size, counter);
}