@Test @SuppressWarnings("unchecked") public void no_row_created_when_result_set_has_no_data() throws SQLException { when(resultSet.next()).thenReturn(false); Consumer<ResultSet> consumer = mock(Consumer.class); boolean result = spliterator.tryAdvance(consumer); assertFalse(result); verify(resultSet, times(1)).next(); }