Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,41 @@ void isLastAlwaysThrowsLikeXerial() throws SQLException {
.hasMessage("not supported by sqlite");
}

@Test
void isFirstIsTrueOnlyOnTheFirstRow() throws SQLException {
LibsqlResultSet resultSet = resultSet(TWO_ROWS);

assertThat(resultSet.isFirst()).isFalse();
assertThat(resultSet.next()).isTrue();
assertThat(resultSet.isFirst()).isTrue();
assertThat(resultSet.next()).isTrue();
assertThat(resultSet.isFirst()).isFalse();
assertThat(resultSet.next()).isFalse();
assertThat(resultSet.isFirst()).isFalse();
assertThat(resultSet.next()).isFalse();
assertThat(resultSet.isFirst()).isFalse();
}

@Test
void isFirstIsTrueOnTheSingleRowAndFalseAfterTheEnd() throws SQLException {
LibsqlResultSet resultSet = resultSet(DUPLICATE_LABELS);

assertThat(resultSet.isFirst()).isFalse();
assertThat(resultSet.next()).isTrue();
assertThat(resultSet.isFirst()).isTrue();
assertThat(resultSet.next()).isFalse();
assertThat(resultSet.isFirst()).isFalse();
}

@Test
void isFirstIsFalseForAnEmptyResultSet() throws SQLException {
LibsqlResultSet resultSet = resultSet(NO_ROWS);

assertThat(resultSet.isFirst()).isFalse();
assertThat(resultSet.next()).isFalse();
assertThat(resultSet.isFirst()).isFalse();
}

@Test
void wasNullThrowsBeforeAnyGetterAndAfterTheEndWithoutAGetter() throws SQLException {
LibsqlResultSet beforeFirst = resultSet(DUPLICATE_LABELS);
Expand Down
Loading