From 33e90fcd880a1d485c108f312e0a7b2a9a3d7179 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 9 Jul 2020 09:51:27 +0200 Subject: [PATCH] Add integration tests for null decode [resolves #163] --- ...metrizedMssqlStatementIntegrationTests.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/io/r2dbc/mssql/ParametrizedMssqlStatementIntegrationTests.java b/src/test/java/io/r2dbc/mssql/ParametrizedMssqlStatementIntegrationTests.java index 74624412..178af9b6 100644 --- a/src/test/java/io/r2dbc/mssql/ParametrizedMssqlStatementIntegrationTests.java +++ b/src/test/java/io/r2dbc/mssql/ParametrizedMssqlStatementIntegrationTests.java @@ -23,6 +23,8 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.util.Optional; + /** * Integration tests for {@link ParametrizedMssqlStatement}. * @@ -54,4 +56,20 @@ void shouldExecuteBatch() { .expectNext(1, 1, 1) .verifyComplete(); } + + @Test + void shouldDecodeNull() { + + shouldExecuteBatch(); + + Flux.from(connection.createStatement("SELECT null, first_name FROM r2dbc_example") + .execute()) + .flatMap(result -> result.map((row, rowMetadata) -> { + return Optional.ofNullable(row.get(0)); + })) + .as(StepVerifier::create) + .expectNext(Optional.empty(), Optional.empty(), Optional.empty()) + .verifyComplete(); + } + }