ResultSetIterator implements Iterator<ResultRow> { @Override public boolean hasNext() { try { return resultSet.hasNext(); } catch (OntoDriverException e) { throw new ResultSetIterationException(e); } } ResultSetIterator(ResultSet resultSet); @Override boolean hasNext(); @Override ResultRow next();  }
@Test void hasNextDelegatesCallToResultSet() throws Exception { sut.hasNext(); verify(resultSet).hasNext(); }
@Test void hasNextThrowsResultSetIterationExceptionWhenResultSetThrowsOntoDriverException() throws Exception { when(resultSet.hasNext()).thenThrow(OntoDriverException.class); final ResultSetIterationException result = assertThrows(ResultSetIterationException.class, () -> sut.hasNext()); assertTrue(result.getCause() instanceof OntoDriverException); }