### Question:
SimpleArray implements Iterable<T> { @Override public Iterator<T> iterator() { return new Iterator<T>() { private int position = 0; @Override public boolean hasNext() { return this.position < size(); } @Override public T next() { if (this.position >= size()) { throw new NoSuchElementException(); } return get(position++); } }; } SimpleArray();  SimpleArray(int size); int size(); void add(T model); void set(int index, T model); void delete(int index); T get(int index); @Override Iterator<T> iterator();  }### Answer:
@Test public void iterator() { SimpleArray<Integer> testArray = new SimpleArray<>(); Iterator<Integer> it = testArray.iterator(); testArray.add(1); testArray.add(2); testArray.add(3); assertThat(it.hasNext(), is(true)); assertThat(it.next(), is(1)); assertThat(it.hasNext(), is(true)); assertThat(it.next(), is(2)); assertThat(it.hasNext(), is(true)); assertThat(it.next(), is(3)); assertThat(it.hasNext(), is(false)); }