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 d97b3db46..479a2c14a 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 @@ -416,4 +416,21 @@ void getObjectMustReturnTheSmallestTypePossibleForInteger() throws SQLException } } + // GH-401 + @Test + void noSurpriseGetString() throws SQLException { + try (var connection = getConnection(); + var stmt = connection.createStatement(); + var result = stmt.executeQuery("RETURN {a: '1', b: '2'} AS m, [1,2,3] AS l")) { + + assertThat(result.next()).isTrue(); + assertThatExceptionOfType(SQLException.class).isThrownBy(() -> result.getString("m")) + .withMessage("MAP value can not be mapped to String"); + assertThat(result.getObject("m")).isInstanceOf(Map.class); + assertThatExceptionOfType(SQLException.class).isThrownBy(() -> result.getString("l")) + .withMessage("LIST OF ANY? value can not be mapped to String"); + assertThat(result.getObject("l")).isInstanceOf(List.class); + } + } + }