@Test void tryAdvanceWhenNoNext() throws SQLException { when(resultSet.next()).thenReturn(false); ResultSetSpliterator<String> sut = new ResultSetSpliterator<>(resultSet, rowMapper); boolean result = sut.tryAdvance(action); verify(resultSet).next(); verifyNoMoreInteractions(resultSet, rowMapper, action); assertThat(result, is(false)); }
@Override public boolean tryAdvance(Consumer<? super T> action) { try { if (exhausted.get() || !resultSet.next()) { if (!exhausted.getAndSet(true)) { atEnd.run(); } return false; } action.accept(rowMapper.mapRow(resultSet)); return true; } catch (SQLException e) { throw new RuntimeSqlException(e); } }
ResultSetSpliterator extends Spliterators.AbstractSpliterator<T> { @Override public boolean tryAdvance(Consumer<? super T> action) { try { if (exhausted.get() || !resultSet.next()) { if (!exhausted.getAndSet(true)) { atEnd.run(); } return false; } action.accept(rowMapper.mapRow(resultSet)); return true; } catch (SQLException e) { throw new RuntimeSqlException(e); } } }
ResultSetSpliterator extends Spliterators.AbstractSpliterator<T> { @Override public boolean tryAdvance(Consumer<? super T> action) { try { if (exhausted.get() || !resultSet.next()) { if (!exhausted.getAndSet(true)) { atEnd.run(); } return false; } action.accept(rowMapper.mapRow(resultSet)); return true; } catch (SQLException e) { throw new RuntimeSqlException(e); } } ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper);  ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper, Runnable atEnd); }
ResultSetSpliterator extends Spliterators.AbstractSpliterator<T> { @Override public boolean tryAdvance(Consumer<? super T> action) { try { if (exhausted.get() || !resultSet.next()) { if (!exhausted.getAndSet(true)) { atEnd.run(); } return false; } action.accept(rowMapper.mapRow(resultSet)); return true; } catch (SQLException e) { throw new RuntimeSqlException(e); } } ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper);  ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper, Runnable atEnd); @Override boolean tryAdvance(Consumer<? super T> action); }
ResultSetSpliterator extends Spliterators.AbstractSpliterator<T> { @Override public boolean tryAdvance(Consumer<? super T> action) { try { if (exhausted.get() || !resultSet.next()) { if (!exhausted.getAndSet(true)) { atEnd.run(); } return false; } action.accept(rowMapper.mapRow(resultSet)); return true; } catch (SQLException e) { throw new RuntimeSqlException(e); } } ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper);  ResultSetSpliterator(ResultSet resultSet, RowMapper<T> rowMapper, Runnable atEnd); @Override boolean tryAdvance(Consumer<? super T> action);  }