### Question:
JdbcRecordSet implements RecordSet { @Override public RecordCursor cursor() { return new JdbcRecordCursor(jdbcClient, session, split, table, columnHandles); } JdbcRecordSet(JdbcClient jdbcClient, ConnectorSession session, JdbcSplit split, JdbcTableHandle table, List<JdbcColumnHandle> columnHandles); @Override List<Type> getColumnTypes(); @Override RecordCursor cursor();  }### Answer:
@Test public void testCursorSimple() { RecordSet recordSet = createRecordSet(ImmutableList.of( columnHandles.get("text"), columnHandles.get("text_short"), columnHandles.get("value"))); try (RecordCursor cursor = recordSet.cursor()) { assertEquals(cursor.getType(0), VARCHAR); assertEquals(cursor.getType(1), createVarcharType(32)); assertEquals(cursor.getType(2), BIGINT); Map<String, Long> data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { data.put(cursor.getSlice(0).toStringUtf8(), cursor.getLong(2)); assertEquals(cursor.getSlice(0), cursor.getSlice(1)); assertFalse(cursor.isNull(0)); assertFalse(cursor.isNull(1)); assertFalse(cursor.isNull(2)); } assertEquals(data, ImmutableMap.<String, Long>builder() .put("one", 1L) .put("two", 2L) .put("three", 3L) .put("ten", 10L) .put("eleven", 11L) .put("twelve", 12L) .build()); } }
@Test public void testCursorMixedOrder() { RecordSet recordSet = createRecordSet(ImmutableList.of( columnHandles.get("value"), columnHandles.get("value"), columnHandles.get("text"))); try (RecordCursor cursor = recordSet.cursor()) { assertEquals(cursor.getType(0), BIGINT); assertEquals(cursor.getType(1), BIGINT); assertEquals(cursor.getType(2), VARCHAR); Map<String, Long> data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { assertEquals(cursor.getLong(0), cursor.getLong(1)); data.put(cursor.getSlice(2).toStringUtf8(), cursor.getLong(0)); } assertEquals(data, ImmutableMap.<String, Long>builder() .put("one", 1L) .put("two", 2L) .put("three", 3L) .put("ten", 10L) .put("eleven", 11L) .put("twelve", 12L) .build()); } }
@Test public void testIdempotentClose() { RecordSet recordSet = createRecordSet(ImmutableList.of( columnHandles.get("value"), columnHandles.get("value"), columnHandles.get("text"))); RecordCursor cursor = recordSet.cursor(); cursor.close(); cursor.close(); }