Skip to content

Commit 5688a12

Browse files
committed
Merge Codec integration tests
Codec integration tests were distributed previously into multiple test classes with duplicating the fixtures. Now all fixtures are defined in AbstractCodecIntegrationTests. [#186]
1 parent 0b63471 commit 5688a12

File tree

2 files changed

+27
-332
lines changed

2 files changed

+27
-332
lines changed

src/test/java/io/r2dbc/postgresql/AbstractCodecIntegrationTests.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ void intPrimitive() {
198198
testCodec(Integer.class, 100, "FLOAT8");
199199
}
200200

201+
@Test
202+
void intTwoDimensionalArray() {
203+
testCodec(Integer[][].class, new Integer[][]{{100, 200}, {300, null}}, "INT4[][]");
204+
}
205+
201206
@Test
202207
void json() {
203208
testCodec(String.class, "{\"hello\": \"world\"}", "JSON", "$1::json");
@@ -289,6 +294,11 @@ void longPrimitive() {
289294
testCodec(Long.class, 100L, "FLOAT8");
290295
}
291296

297+
@Test
298+
void longTwoDimensionalArray() {
299+
testCodec(Long[][].class, new Long[][]{{100L, 200L}, {300L, null}}, "INT8[][]");
300+
}
301+
292302
@Test
293303
void offsetDateTime() {
294304
testCodec(OffsetDateTime.class, OffsetDateTime.now(), (actual, expected) -> assertThat(actual.isEqual(expected)).isTrue(), "TIMESTAMP WITH TIME ZONE");
@@ -304,6 +314,11 @@ void shortPrimitive() {
304314
testCodec(Short.class, (short) 100, "INT2");
305315
}
306316

317+
@Test
318+
void shortTwoDimensionalArray() {
319+
testCodec(Short[][].class, new Short[][]{{100, 200}, {300, null}}, "INT2[][]");
320+
}
321+
307322
@Test
308323
void string() {
309324
testCodec(String.class, "test-value", (actual, expected) -> assertThat(actual).isEqualToIgnoringWhitespace(expected), "BPCHAR(32)");
@@ -318,6 +333,18 @@ void stringArray() {
318333
testCodec(String[].class, new String[]{"NULL", "", "test value3", "hello\\world"}, "TEXT[]");
319334
}
320335

336+
@Test
337+
void stringArrayValueEscaping() {
338+
testCodec(String[].class, new String[]{"NULL", null, "R \"2\" DBC", "АБ"}, "BPCHAR[]");
339+
testCodec(String[].class, new String[]{"NULL", null, "R \"2\" DBC", "АБ"}, "VARCHAR[]");
340+
}
341+
342+
@Test
343+
void stringTwoDimensionalArray() {
344+
testCodec(String[][].class, new String[][]{{"test-value1"}, {"test-value2"}}, "BPCHAR[]");
345+
testCodec(String[][].class, new String[][]{{"test-value1"}, {"test-value2"}}, "VARCHAR[]");
346+
}
347+
321348
@Test
322349
void uri() {
323350
testCodec(URI.class, URI.create("https://localhost"), "BPCHAR(128)");

src/test/java/io/r2dbc/postgresql/codec/CodecIntegrationTests.java

Lines changed: 0 additions & 332 deletions
This file was deleted.

0 commit comments

Comments
 (0)