### Question:
ResultSetIterator implements Iterator<ResultSet>, Iterable<ResultSet> { @Override public final ResultSet next() { return this.resultSet; } ResultSetIterator(ResultSet resultSet); @Override boolean hasNext(); @Override final ResultSet next(); @Override Iterator<ResultSet> iterator();  }### Answer:
@Test public void emptyResultSet() throws SQLException { when(this.mockedResultSet.next()).thenReturn(false); for (ResultSet resultSet : cut) { fail("Should not iterate over an empty resultset"); } }
@Test public void resultSet() throws SQLException { when(this.mockedResultSet.next()).thenReturn(true, false); boolean iterated = false; for (ResultSet resultSet : cut) { iterated = true; } assertTrue(iterated); }