|
1 | 1 | package com.clickhouse.jdbc; |
2 | 2 |
|
3 | | -import static org.testng.Assert.assertEquals; |
4 | | -import static org.testng.Assert.assertTrue; |
| 3 | +import org.testng.Assert; |
| 4 | +import org.testng.annotations.Test; |
5 | 5 |
|
6 | 6 | import java.io.InputStream; |
7 | 7 | import java.io.Reader; |
|
19 | 19 | import java.sql.ResultSetMetaData; |
20 | 20 | import java.sql.SQLException; |
21 | 21 | import java.sql.SQLFeatureNotSupportedException; |
22 | | -import java.sql.SQLType; |
23 | 22 | import java.sql.Statement; |
24 | 23 | import java.sql.Time; |
25 | 24 | import java.sql.Timestamp; |
26 | 25 | import java.sql.Types; |
27 | 26 | import java.util.Properties; |
28 | 27 |
|
29 | | -import org.testng.Assert; |
30 | | -import org.testng.annotations.Test; |
| 28 | +import static org.testng.Assert.assertEquals; |
| 29 | +import static org.testng.Assert.assertTrue; |
31 | 30 |
|
32 | 31 | public class ResultSetImplTest extends JdbcIntegrationTest { |
33 | 32 |
|
@@ -69,16 +68,16 @@ public void testUnsupportedOperations() throws Throwable { |
69 | 68 | try (Connection conn = this.getJdbcConnection(props); Statement stmt = conn.createStatement(); |
70 | 69 | ResultSet rs = stmt.executeQuery("SELECT 1")) { |
71 | 70 | Assert.ThrowingRunnable[] rsUnsupportedMethods = new Assert.ThrowingRunnable[]{ |
72 | | - () -> rs.first(), |
73 | | - () -> rs.afterLast(), |
74 | | - () -> rs.beforeFirst(), |
| 71 | + rs::first, |
| 72 | + rs::afterLast, |
| 73 | + rs::beforeFirst, |
75 | 74 | () -> rs.absolute(-1), |
76 | 75 | () -> rs.relative(-1), |
77 | | - () -> rs.moveToCurrentRow(), |
78 | | - () -> rs.moveToInsertRow(), |
79 | | - () -> rs.last(), |
80 | | - () -> rs.previous(), |
81 | | - () -> rs.refreshRow(), |
| 76 | + rs::moveToCurrentRow, |
| 77 | + rs::moveToInsertRow, |
| 78 | + rs::last, |
| 79 | + rs::previous, |
| 80 | + rs::refreshRow, |
82 | 81 | () -> rs.updateBoolean("col1", true), |
83 | 82 | () -> rs.updateByte("col1", (byte) 1), |
84 | 83 | () -> rs.updateShort("col1", (short) 1), |
@@ -181,20 +180,20 @@ public void testUnsupportedOperations() throws Throwable { |
181 | 180 | () -> rs.getRef("col1"), |
182 | 181 | () -> rs.getRowId(1), |
183 | 182 | () -> rs.getRowId("col1"), |
184 | | - () -> rs.cancelRowUpdates(), |
| 183 | + rs::cancelRowUpdates, |
185 | 184 | () -> rs.updateNull(1), |
186 | 185 | () -> rs.updateNull("col1"), |
187 | 186 | () -> rs.updateRowId(1, null), |
188 | 187 | () -> rs.updateRowId("col1", null), |
189 | 188 | () -> rs.updateClob(1, (Clob) null), |
190 | 189 | () -> rs.updateClob("col1", (Clob) null), |
191 | | - () -> rs.updateRow(), |
192 | | - () -> rs.insertRow(), |
193 | | - () -> rs.deleteRow(), |
194 | | - () -> rs.rowDeleted(), |
195 | | - () -> rs.rowInserted(), |
196 | | - () -> rs.rowUpdated(), |
197 | | - () -> rs.getCursorName(), |
| 190 | + rs::updateRow, |
| 191 | + rs::insertRow, |
| 192 | + rs::deleteRow, |
| 193 | + rs::rowDeleted, |
| 194 | + rs::rowInserted, |
| 195 | + rs::rowUpdated, |
| 196 | + rs::getCursorName, |
198 | 197 | }; |
199 | 198 |
|
200 | 199 | for (Assert.ThrowingRunnable op : rsUnsupportedMethods) { |
@@ -339,10 +338,10 @@ public void testGetMetadata() throws SQLException { |
339 | 338 |
|
340 | 339 | ResultSetMetaData metaData = rs.getMetaData(); |
341 | 340 | Assert.assertEquals(metaData.getColumnCount(), 2); |
342 | | - Assert.assertEquals(metaData.getColumnType(1), Types.INTEGER); |
343 | | - Assert.assertEquals(metaData.getColumnType(2), Types.VARCHAR); |
344 | | - Assert.assertEquals(metaData.getColumnTypeName(1), "Int32"); |
345 | | - Assert.assertEquals(metaData.getColumnTypeName(2), "String"); |
| 341 | + Assert.assertEquals(metaData.getColumnType(v1ColumnIndex), Types.INTEGER); |
| 342 | + Assert.assertEquals(metaData.getColumnType(v2ColumnIndex), Types.VARCHAR); |
| 343 | + Assert.assertEquals(metaData.getColumnTypeName(v1ColumnIndex), "Int32"); |
| 344 | + Assert.assertEquals(metaData.getColumnTypeName(v1ColumnIndex), "String"); |
346 | 345 | } |
347 | 346 | } |
348 | 347 | } |
|
0 commit comments