[ https://issues.apache.org/jira/browse/CALCITE-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350407#comment-16350407 ]
ASF GitHub Bot commented on CALCITE-508: ---------------------------------------- Github user asolimando commented on a diff in the pull request: https://github.com/apache/calcite-avatica/pull/23#discussion_r165660178 --- Diff: core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetThrowsSqlExceptionTest.java --- @@ -75,11 +90,118 @@ public void testUpdateNull() throws SQLException { final TestDriver driver = new TestDriver(); try (Connection connection = driver.connect("jdbc:test", properties); ResultSet resultSet = - connection.createStatement().executeQuery("SELECT * FROM TABLE")) { + connection.createStatement().executeQuery("SELECT * FROM TABLE")) { thrown.expect(SQLFeatureNotSupportedException.class); resultSet.updateNull(1); } } -} + @Test + public void testCommonCursorStates() throws SQLException { + final ResultSet resultSet = getResultSet(); + + // right after statement execution, result set is before first row + assert resultSet.isBeforeFirst(); + + // retrieve each row until the last one + while (!resultSet.isAfterLast()) { + assert resultSet.next() != resultSet.isAfterLast(); --- End diff -- I have replaced them with the JUnit counterparts (e.g., Assert.assertTrue), this would do? > Reading from ResultSet before calling next() should throw SQLException not > NoSuchElementException > ------------------------------------------------------------------------------------------------- > > Key: CALCITE-508 > URL: https://issues.apache.org/jira/browse/CALCITE-508 > Project: Calcite > Issue Type: Bug > Reporter: Julian Hyde > Assignee: Julian Hyde > Priority: Major > Labels: newbie > > Reading from ResultSet before calling next() should throw SQLException not > NoSuchElementException. > Each of the Cursor.Accessor.getXxx methods should convert runtime exceptions > to SQLException. > JdbcTest.testExtract currently demonstrates this problem; it passes if there > is a NoSuchElementException, but should look for a SQLException. -- This message was sent by Atlassian JIRA (v7.6.3#76005)