### Question:
ResultSetIterator implements RelationalInput { @Override public boolean hasNext() throws InputIterationException { if (!nextCalled) { try { hasNext = resultSet.next(); } catch (SQLException e) { throw new InputIterationException("Could not retrieve next row", e); } nextCalled = true; } return hasNext; } ResultSetIterator(ResultSet resultSet);  ResultSetIterator(ResultSet resultSet, String relationName); @Override boolean hasNext(); @Override List<String> next(); @Override int numberOfColumns(); @Override String relationName(); @Override ImmutableList<String> columnNames(); @Override void close(); static final String UNKNOWN_RELATION_NAME; }### Answer:
@Test public void testHasNext() throws SQLException, InputIterationException { ResultSet resultSet = minimalResultSetFixture.getTestData(); ResultSetIterator resultSetIterator = new ResultSetIterator(resultSet); boolean expectedFirstNext = true; boolean expectedSecondNext = false; when(resultSet.next()) .thenReturn(expectedFirstNext) .thenReturn(false); assertEquals(expectedFirstNext, resultSetIterator.hasNext()); assertEquals(expectedFirstNext, resultSetIterator.hasNext()); resultSetIterator.next(); assertEquals(expectedSecondNext, resultSetIterator.hasNext()); }