Skip to content

Commit

Permalink
build: Add a test for consistency of nested object types.
Browse files Browse the repository at this point in the history
See old isse #412
  • Loading branch information
michael-simons committed Feb 22, 2024
1 parent 8635de3 commit c586e3d
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -28,6 +28,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.stream.Stream;
Expand Down Expand Up @@ -460,4 +461,28 @@ private Stream<Arguments> getExecuteWithRowLimitArgs() {
Arguments.of(1000, 5000, 1000), Arguments.of(0, 0, 1000));
}

// GH-412
@SuppressWarnings("unchecked")
@Test
void mappingOfTimestampsMustBeConsistent() throws SQLException {
var query = """
WITH datetime('2015-06-24T12:50:35.556+0100') AS zonedDateTime
RETURN
zonedDateTime,
[zonedDateTime] AS zonedDateTimeList,
{zonedDateTime: zonedDateTime} AS zonedDateTimeDictionary""";
try (var connection = getConnection(); var results = connection.createStatement().executeQuery(query)) {

while (results.next()) {
var theDateTime = results.getObject("zonedDateTime");
assertThat(theDateTime).isInstanceOf(ZonedDateTime.class);
theDateTime = ((Iterable<Object>) results.getObject("zonedDateTimeList")).iterator().next();
assertThat(theDateTime).isInstanceOf(ZonedDateTime.class);
theDateTime = ((Map<String, Object>) results.getObject("zonedDateTimeDictionary")).get("zonedDateTime");
assertThat(theDateTime).isInstanceOf(ZonedDateTime.class);
}

}
}

}

0 comments on commit c586e3d

Please sign in to comment.