Code example for ResultSet

Methods: close, getInt, next

0
 
        Statement statement = shadowOf(database).getConnection().createStatement();
        final String select = "SELECT COUNT(*) FROM table_name";
 
        ResultSet rs = statement.executeQuery(select);
        assertThat(rs.next()).isTrue();
        assertThat(rs.getInt(1)).isEqualTo(1);
        rs.close();
 
        assertThat(shDatabase.isTransactionSuccess()).isFalse();
        database.endTransaction();
 
        statement = shadowOf(database).getConnection().createStatement();
        rs = statement.executeQuery(select);
        assertThat(rs.next()).isTrue();
        assertThat(rs.getInt(1)).isEqualTo(0);
 
        assertThat(shDatabase.isTransactionSuccess()).isFalse();
    } 
 
    @Test