|
4 | 4 | import org.testng.annotations.Ignore; |
5 | 5 | import org.testng.annotations.Test; |
6 | 6 |
|
| 7 | +import java.sql.Array; |
7 | 8 | import java.sql.Connection; |
8 | 9 | import java.sql.PreparedStatement; |
9 | 10 | import java.sql.ResultSet; |
@@ -233,9 +234,15 @@ public void testPrimitiveArrays() throws Exception { |
233 | 234 | stmt.setObject(1, new String[][] {new String[]{"a"}, new String[]{"b"}, new String[]{"c"}}); |
234 | 235 | try (ResultSet rs = stmt.executeQuery()) { |
235 | 236 | assertTrue(rs.next()); |
236 | | - assertEquals(((BinaryStreamReader.ArrayValue)((BinaryStreamReader.ArrayValue)rs.getObject(1)).get(0)).get(0), "a"); |
237 | | - assertEquals(((BinaryStreamReader.ArrayValue)((BinaryStreamReader.ArrayValue)rs.getObject(1)).get(1)).get(0), "b"); |
238 | | - assertEquals(((BinaryStreamReader.ArrayValue)((BinaryStreamReader.ArrayValue)rs.getObject(1)).get(2)).get(0), "c"); |
| 237 | + Array a1 = rs.getArray(1); |
| 238 | + assertNotNull(a1); |
| 239 | + assertEquals(Arrays.deepToString((Object[]) a1.getArray()), "[[a], [b], [c]]"); |
| 240 | + Array a2 = rs.getObject(1, Array.class); |
| 241 | + assertNotNull(a2); |
| 242 | + assertEquals(Arrays.deepToString((Object[]) a2.getArray()), "[[a], [b], [c]]"); |
| 243 | + Array a3 = rs.getObject(1) instanceof Array ? (Array) rs.getObject(1) : null; |
| 244 | + assertNotNull(a3); |
| 245 | + assertEquals(Arrays.deepToString((Object[]) a3.getArray()), "[[a], [b], [c]]"); |
239 | 246 | assertFalse(rs.next()); |
240 | 247 | } |
241 | 248 | } |
|
0 commit comments