public void testHasNextThrow() throws Exception {
ConnectionSource cs = createMock(ConnectionSource.class);
cs.releaseConnection(null);
CompiledStatement stmt = createMock(CompiledStatement.class);
DatabaseResults results = createMock(DatabaseResults.class);
expect(stmt.runQuery(null)).andReturn(results);
expect(results.first()).andThrow(new SQLException("some database problem"));
stmt.close();
replay(stmt, results, cs);
SelectIterator<Foo, Integer> iterator =
new SelectIterator<Foo, Integer>(Foo.class, null, null, cs, null, stmt, "statement", null);