Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zero88 committed Nov 12, 2022
1 parent c1921f0 commit c3ea243
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}));
Expand All @@ -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();
}));
Expand All @@ -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();
}));
Expand All @@ -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();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}));
Expand Down

0 comments on commit c3ea243

Please sign in to comment.