Skip to content

Commit

Permalink
chore: Add a test that scalar properties are handled according to spec.
Browse files Browse the repository at this point in the history
This affects #81, but does not close it, as it cannot be tested with RapidMiner, as RapidMiner does not work with JDK17.
  • Loading branch information
michael-simons committed Mar 1, 2024
1 parent ae22117 commit 40d83ed
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,35 @@ void noPropertyNamesShouldBeSpecial() throws SQLException {
}
}

// GH-81
@Test
void nullPropertiesShallNotFailWhenBeAccessed() throws SQLException {
try (var connection = getConnection(); var stmt = connection.createStatement();) {
connection.setAutoCommit(false);
stmt.executeUpdate("CREATE (n:mynode {order_prop:1, aninteger: 42})");
stmt.executeUpdate("CREATE (n:mynode {order_prop:2})");
connection.commit();
}
try (var connection = getConnection(); var stmt = connection.createStatement();) {
try (var result = stmt.executeQuery("MATCH (n:mynode) RETURN n ORDER BY n.order_prop ASC")) {
assertThat(result.next()).isTrue();
assertThat(result.getObject("n", Value.class).get("aninteger").asInt()).isEqualTo(42);
assertThat(result.next()).isTrue();
assertThat(result.getObject("n", Value.class).get("aninteger").isNull()).isTrue();
assertThat(result.next()).isFalse();
}

try (var result = stmt.executeQuery("MATCH (n:mynode) RETURN n.aninteger ORDER BY n.order_prop ASC")) {
assertThat(result.next()).isTrue();
assertThat(result.getInt(1)).isEqualTo(42);
assertThat(result.next()).isTrue();
assertThat(result.getInt(1)).isZero();
assertThat(result.wasNull()).isTrue();
assertThat(result.next()).isFalse();
}

}

}

}

0 comments on commit 40d83ed

Please sign in to comment.