diff --git a/neo4j-jdbc-it/neo4j-jdbc-it-cp/src/test/java/org/neo4j/jdbc/it/cp/StatementIT.java b/neo4j-jdbc-it/neo4j-jdbc-it-cp/src/test/java/org/neo4j/jdbc/it/cp/StatementIT.java index 519c83a09..cc6ef9715 100644 --- a/neo4j-jdbc-it/neo4j-jdbc-it-cp/src/test/java/org/neo4j/jdbc/it/cp/StatementIT.java +++ b/neo4j-jdbc-it/neo4j-jdbc-it-cp/src/test/java/org/neo4j/jdbc/it/cp/StatementIT.java @@ -28,6 +28,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.util.List; import java.util.Map; import java.util.TimeZone; import java.util.UUID; @@ -39,6 +40,7 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; +import org.neo4j.jdbc.values.Value; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -485,4 +487,24 @@ WITH datetime('2015-06-24T12:50:35.556+0100') AS zonedDateTime } } + // GH-397 + @SuppressWarnings("deprecation") + @Test + void elementIdAndIdShouldBeSupported() throws SQLException { + try (var connection = getConnection(); + var stmt = connection.createStatement(); + var result = stmt.executeQuery( + "CREATE (n:Test {name: 'A', _id: 'id1', _labels: ['L1', 'L2']}) -[r:RELATES_TO {name: 'R', _id: 'id2', _startId: 4711, _endId: 23, _type: 'Trololo'}] -> (m:AnotherTest {name: 'B', _id: 'id3'}) RETURN *")) { + assertThat(result.next()).isTrue(); + var nodeA = result.getObject("n", Value.class).asNode(); + var rel = result.getObject("r", Value.class).asRelationship(); + var nodeB = result.getObject("m", Value.class).asNode(); + assertThat(nodeA.asMap()) + .containsExactlyInAnyOrderEntriesOf(Map.of("name", "A", "_id", "id1", "_labels", List.of("L1", "L2"))); + assertThat(rel.asMap()).containsExactlyInAnyOrderEntriesOf( + Map.of("name", "R", "_id", "id2", "_startId", 4711L, "_endId", 23L, "_type", "Trololo")); + assertThat(nodeB.asMap()).containsExactlyInAnyOrderEntriesOf(Map.of("name", "B", "_id", "id3")); + } + } + }