BaseFinishedSqlPart extends BaseSqlPart implements FinishedSqlPart { @NotNull @Override public final Iterator<SqlPart> iterator() { return new SqlPartIterator(this); }  @NotNull @Override final Iterator<SqlPart> iterator();  }
@Test public void iterator_returnsProperIterator() { SqlPart sqlPart = mock(SqlPart.class); TestBaseFinishedSqlPart statement = new TestBaseFinishedSqlPart(sqlPart); Iterator<SqlPart> iterator = statement.iterator(); assertThat(iterator.hasNext(), is(true)); assertThat(iterator.next(), is((SqlPart) statement)); assertThat(iterator.hasNext(), is(true)); assertThat(iterator.next(), is(sqlPart)); assertThat(iterator.hasNext(), is(false)); }