From c3ea24354017c857e00239fa711921f9cf17267c Mon Sep 17 00:00:00 2001 From: zero88 Date: Sat, 12 Nov 2022 13:14:28 +0700 Subject: [PATCH] Fix some tests --- .../vertx/pgclient/data/BooleanTypeExtendedCodecTest.java | 3 +++ .../pgclient/data/DateTimeTypesExtendedCodecTest.java | 1 + .../pgclient/data/EnumeratedTypesExtendedCodecTest.java | 7 +++++++ .../io/vertx/pgclient/data/UUIDTypeExtendedCodecTest.java | 3 +++ 4 files changed, 14 insertions(+) diff --git a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/BooleanTypeExtendedCodecTest.java b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/BooleanTypeExtendedCodecTest.java index fa57085c8..d4735d91f 100644 --- a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/BooleanTypeExtendedCodecTest.java +++ b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/BooleanTypeExtendedCodecTest.java @@ -1,5 +1,6 @@ package io.vertx.pgclient.data; +import io.vertx.core.json.JsonArray; import io.vertx.pgclient.PgConnection; import io.vertx.sqlclient.ColumnChecker; import io.vertx.sqlclient.Row; @@ -53,7 +54,9 @@ public void testDecodeBooleanArray_(TestContext ctx) { .addInteger(1), ctx.asyncAssertSuccess(result -> { ColumnChecker.checkColumn(0, "Boolean") .returns(Tuple::getValue, Row::getValue, ColumnChecker.toObjectArray(new boolean[]{Boolean.TRUE})) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of(true)) .returns(Tuple::getArrayOfBooleans, Row::getArrayOfBooleans, ColumnChecker.toObjectArray(new boolean[]{Boolean.TRUE})) + .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, ColumnChecker.toObjectArray(new String[]{Boolean.TRUE.toString()})) .forRow(result.iterator().next()); async.complete(); })); diff --git a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/DateTimeTypesExtendedCodecTest.java b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/DateTimeTypesExtendedCodecTest.java index 2cfb38234..4b80faeba 100644 --- a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/DateTimeTypesExtendedCodecTest.java +++ b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/DateTimeTypesExtendedCodecTest.java @@ -522,6 +522,7 @@ public void testEncodeLocalDateTimeArray(TestContext ctx) { .returns(Tuple::getArrayOfLocalTimes, Row::getArrayOfLocalTimes, new LocalTime[]{dt.toLocalTime()}) .returns(Tuple::getArrayOfLocalDates, Row::getArrayOfLocalDates, new LocalDate[]{dt.toLocalDate()}) .returns(Tuple::getArrayOfLocalDateTimes, Row::getArrayOfLocalDateTimes, new LocalDateTime[]{dt}) + .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{"2017-05-14T19:35:58.237666"}) .forRow(result.iterator().next()); async.complete(); })); diff --git a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/EnumeratedTypesExtendedCodecTest.java b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/EnumeratedTypesExtendedCodecTest.java index be3a74839..2d07978d4 100644 --- a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/EnumeratedTypesExtendedCodecTest.java +++ b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/EnumeratedTypesExtendedCodecTest.java @@ -1,5 +1,6 @@ package io.vertx.pgclient.data; +import io.vertx.core.json.JsonArray; import io.vertx.pgclient.PgConnection; import io.vertx.sqlclient.ColumnChecker; import io.vertx.sqlclient.Row; @@ -65,6 +66,7 @@ public void testDecodeEnumArray(TestContext ctx) { ColumnChecker.checkColumn(0, "Enum") .returns(Tuple::getValue, Row::getValue, expected) .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, expected) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of("ok", "unhappy", "happy")) .forRow(result.iterator().next()); async.complete(); })); @@ -85,6 +87,7 @@ public void testEncodeEnumArray(TestContext ctx) { ColumnChecker.checkColumn(0, "Enum") .returns(Tuple::getValue, Row::getValue, new String[]{"unhappy"}) .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{"unhappy"}) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of("unhappy")) .forRow(result.iterator().next()); async.complete(); })); @@ -105,6 +108,7 @@ public void testEncodeEnumArrayMultipleValues(TestContext ctx) { ColumnChecker.checkColumn(0, "Enum") .returns(Tuple::getValue, Row::getValue, new String[]{"unhappy", "ok"}) .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{"unhappy", "ok"}) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of("unhappy", "ok")) .forRow(result.iterator().next()); async.complete(); })); @@ -125,10 +129,13 @@ public void testEncodeEnumArrayEmptyValues(TestContext ctx) { ColumnChecker.checkColumn(0, "Enum") .returns(Tuple::getValue, Row::getValue, new String[]{}) .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{}) + .returns(Tuple::getJsonArray, Row::getJsonArray, new JsonArray()) .forRow(result.iterator().next()); ColumnChecker.checkColumn(1, "Boolean") .returns(Tuple::getValue, Row::getValue, new Boolean[]{true}) .returns(Tuple::getArrayOfBooleans, Row::getArrayOfBooleans, new Boolean[]{true}) + .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{"true"}) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of(true)) .forRow(result.iterator().next()); async.complete(); })); diff --git a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/UUIDTypeExtendedCodecTest.java b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/UUIDTypeExtendedCodecTest.java index 852568ed9..2d2c0300b 100644 --- a/vertx-pg-client/src/test/java/io/vertx/pgclient/data/UUIDTypeExtendedCodecTest.java +++ b/vertx-pg-client/src/test/java/io/vertx/pgclient/data/UUIDTypeExtendedCodecTest.java @@ -1,5 +1,6 @@ package io.vertx.pgclient.data; +import io.vertx.core.json.JsonArray; import io.vertx.pgclient.PgConnection; import io.vertx.sqlclient.ColumnChecker; import io.vertx.sqlclient.Row; @@ -59,6 +60,8 @@ public void testEncodeUUIDArray(TestContext ctx) { ColumnChecker.checkColumn(0, "UUID") .returns(Tuple::getValue, Row::getValue, new UUID[]{uuid}) .returns(Tuple::getArrayOfUUIDs, Row::getArrayOfUUIDs, new UUID[]{uuid}) + .returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{uuid.toString()}) + .returns(Tuple::getJsonArray, Row::getJsonArray, JsonArray.of(uuid)) .forRow(result.iterator().next()); async.complete(); }));