diff --git a/.gitignore b/.gitignore index a252922..5804f84 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ /postgresql-42.7.5-jdbc-src.tar.gz /postgresql-42.7.6-jdbc-src.tar.gz /postgresql-42.7.7-jdbc-src.tar.gz +/postgresql-42.7.8-jdbc-src.tar.gz diff --git a/0001-Port-to-junit-5.13.patch b/0001-Port-to-junit-5.13.patch deleted file mode 100644 index 6614f4d..0000000 --- a/0001-Port-to-junit-5.13.patch +++ /dev/null @@ -1,10806 +0,0 @@ -From 2850731d1922c65305777a3fcd58e816b5c1e15f Mon Sep 17 00:00:00 2001 -From: Marian Koncek -Date: Wed, 6 Aug 2025 10:06:10 +0200 -Subject: [PATCH] Port to junit 5.13 - -Upstream: https://github.com/pgjdbc/pgjdbc/commit/e20c132b1380db66077ea92acf6114ad3a605584 - ---- - .../core/OidValuesCorrectnessTest.java | 30 +- - .../org/postgresql/jdbc/BitFieldTest.java | 24 +- - .../jdbc/DeepBatchedInsertStatementTest.java | 4 +- - .../jdbc/LargeObjectManagerTest.java | 4 +- - .../jdbc/NoColumnMetadataIssue1613Test.java | 6 +- - .../org/postgresql/jdbc/PgSQLXMLTest.java | 18 +- - .../test/annotations/tags/Slow.java | 19 + - .../core/LogServerMessagePropertyTest.java | 4 +- - .../test/core/NativeQueryBindLengthTest.java | 28 +- - .../test/core/QueryExecutorTest.java | 2 +- - .../test/extensions/HStoreTest.java | 16 +- - .../org/postgresql/test/jdbc2/ArrayTest.java | 392 ++++++------- - .../test/jdbc2/AutoRollbackTest.java | 95 ++-- - .../org/postgresql/test/jdbc2/BaseTest4.java | 82 ++- - .../test/jdbc2/BatchExecuteTest.java | 176 +++--- - .../test/jdbc2/BatchFailureTest.java | 58 +- - .../BatchedInsertReWriteEnabledTest.java | 38 +- - .../test/jdbc2/CallableStmtTest.java | 39 +- - .../test/jdbc2/ClientEncodingTest.java | 25 +- - .../test/jdbc2/ConcurrentStatementFetch.java | 81 --- - .../test/jdbc2/ConnectTimeoutTest.java | 20 +- - .../test/jdbc2/CursorFetchTest.java | 214 ++++---- - .../CustomTypeWithBinaryTransferTest.java | 50 +- - .../test/jdbc2/DatabaseEncodingTest.java | 4 +- - .../test/jdbc2/DatabaseMetaDataTest.java | 402 ++++++-------- - .../postgresql/test/jdbc2/DateStyleTest.java | 20 +- - .../org/postgresql/test/jdbc2/DateTest.java | 39 +- - .../org/postgresql/test/jdbc2/EnumTest.java | 46 +- - .../postgresql/test/jdbc2/GeometricTest.java | 22 +- - .../test/jdbc2/NumericTransferTest.java | 30 +- - .../test/jdbc2/NumericTransferTest2.java | 114 ---- - .../test/jdbc2/OuterJoinSyntaxTest.java | 7 +- - .../test/jdbc2/PGObjectGetTest.java | 34 +- - .../test/jdbc2/PGObjectSetTest.java | 30 +- - .../org/postgresql/test/jdbc2/PGTimeTest.java | 10 +- - .../test/jdbc2/ParameterStatusTest.java | 70 +-- - .../test/jdbc2/PreparedStatementTest.java | 519 ++++++++---------- - .../postgresql/test/jdbc2/QuotationTest.java | 26 +- - .../test/jdbc2/RefCursorFetchTest.java | 31 +- - .../postgresql/test/jdbc2/RefCursorTest.java | 28 +- - .../test/jdbc2/ReplaceProcessingTest.java | 20 +- - .../test/jdbc2/ResultSetMetaDataTest.java | 29 +- - .../test/jdbc2/ResultSetRefreshTest.java | 4 +- - .../postgresql/test/jdbc2/ResultSetTest.java | 169 +++--- - .../test/jdbc2/ServerCursorTest.java | 10 +- - .../test/jdbc2/ServerErrorTest.java | 8 +- - .../test/jdbc2/ServerPreparedStmtTest.java | 21 +- - .../postgresql/test/jdbc2/StatementTest.java | 7 +- - .../jdbc2/StringTypeUnspecifiedArrayTest.java | 15 +- - .../postgresql/test/jdbc2/TimestampTest.java | 46 +- - .../test/jdbc2/TimezoneCachingTest.java | 143 ++--- - .../test/jdbc2/TypeCacheDLLStressTest.java | 2 +- - .../test/jdbc2/UpdateableResultTest.java | 38 +- - .../org/postgresql/test/jdbc2/UpsertTest.java | 27 +- - .../jdbc2/optional/BaseDataSourceTest.java | 34 +- - .../jdbc2/optional/ConnectionPoolTest.java | 35 +- - .../jdbc2/optional/PoolingDataSourceTest.java | 15 +- - .../jdbc2/optional/SimpleDataSourceTest.java | 13 +- - .../SimpleDataSourceWithSetURLTest.java | 4 +- - .../postgresql/test/jdbc3/CompositeTest.java | 13 +- - ...scapeSyntaxCallModeCallIfNoReturnTest.java | 12 +- - .../jdbc3/EscapeSyntaxCallModeCallTest.java | 10 +- - .../jdbc3/EscapeSyntaxCallModeSelectTest.java | 12 +- - .../test/jdbc3/GeneratedKeysTest.java | 95 ++-- - .../jdbc3/Jdbc3CallableStatementTest.java | 35 +- - .../test/jdbc3/ParameterMetaDataTest.java | 19 +- - .../test/jdbc3/ProcedureTransactionTest.java | 19 +- - .../test/jdbc3/SendRecvBufferSizeTest.java | 8 +- - .../test/jdbc3/StringTypeParameterTest.java | 31 +- - .../postgresql/test/jdbc3/TestReturning.java | 124 ----- - .../org/postgresql/test/jdbc3/TypesTest.java | 20 +- - .../org/postgresql/test/jdbc4/ArrayTest.java | 251 +++++---- - .../test/jdbc4/BinaryStreamTest.java | 7 +- - .../org/postgresql/test/jdbc4/BinaryTest.java | 14 +- - .../test/jdbc4/CharacterStreamTest.java | 26 +- - .../postgresql/test/jdbc4/ClientInfoTest.java | 22 +- - .../test/jdbc4/DatabaseMetaDataTest.java | 8 +- - .../postgresql/test/jdbc4/IsValidTest.java | 20 +- - .../org/postgresql/test/jdbc4/JsonbTest.java | 35 +- - .../org/postgresql/test/jdbc4/UUIDTest.java | 21 +- - .../org/postgresql/test/jdbc4/XmlTest.java | 24 +- - .../test/jdbc4/jdbc41/AbortTest.java | 13 +- - .../test/jdbc42/AdaptiveFetchSizeTest.java | 4 +- - .../jdbc42/GetObject310InfinityTests.java | 20 +- - .../test/jdbc42/GetObject310Test.java | 22 +- - .../jdbc42/Jdbc42CallableStatementTest.java | 6 +- - .../test/jdbc42/LargeCountJdbc42Test.java | 80 +-- - .../jdbc42/PreparedStatement64KBindsTest.java | 24 +- - .../test/jdbc42/PreparedStatementTest.java | 16 +- - .../jdbc42/SetObject310InfinityTests.java | 25 +- - .../test/jdbc42/SetObject310Test.java | 59 +- - .../test/jdbc42/SimpleJdbc42Test.java | 4 +- - .../test/util/ByteStreamWriterTest.java | 27 +- - .../org.junit.jupiter.api.extension.Extension | 1 - - 94 files changed, 2057 insertions(+), 2567 deletions(-) - create mode 100644 src/test/java/org/postgresql/test/annotations/tags/Slow.java - delete mode 100644 src/test/java/org/postgresql/test/jdbc2/ConcurrentStatementFetch.java - delete mode 100644 src/test/java/org/postgresql/test/jdbc2/NumericTransferTest2.java - delete mode 100644 src/test/java/org/postgresql/test/jdbc3/TestReturning.java - delete mode 100644 src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension - -diff --git a/src/test/java/org/postgresql/core/OidValuesCorrectnessTest.java b/src/test/java/org/postgresql/core/OidValuesCorrectnessTest.java -index 5446e62..8069fa3 100644 ---- a/src/test/java/org/postgresql/core/OidValuesCorrectnessTest.java -+++ b/src/test/java/org/postgresql/core/OidValuesCorrectnessTest.java -@@ -5,14 +5,17 @@ - - package org.postgresql.core; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; -+ - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.Parameter; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.lang.reflect.Field; - import java.sql.ResultSet; -@@ -28,12 +31,13 @@ import java.util.Map; - /** - * Test to check if values in Oid class are correct with Oid values in a database. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "oidName={0}, oidValue={1}") -+@MethodSource("data") - public class OidValuesCorrectnessTest extends BaseTest4 { - -- @Parameterized.Parameter(0) -+ @Parameter(0) - public String oidName; -- @Parameterized.Parameter(1) -+ @Parameter(1) - public int oidValue; - - /** -@@ -100,7 +104,6 @@ public class OidValuesCorrectnessTest extends BaseTest4 { - oidTypeNames.put("REF_CURSOR_ARRAY", "_REFCURSOR"); - } - -- @Parameterized.Parameters(name = "oidName={0}, oidValue={1}") - public static Iterable data() throws IllegalAccessException { - Field[] fields = Oid.class.getFields(); - List data = new ArrayList<>(); -@@ -122,7 +125,7 @@ public class OidValuesCorrectnessTest extends BaseTest4 { - public void testValue() throws SQLException { - // check if Oid can be tested with given database by checking version - if (oidsMinimumVersions.containsKey(oidName)) { -- Assume.assumeTrue(TestUtil.haveMinimumServerVersion(con, oidsMinimumVersions.get(oidName))); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, oidsMinimumVersions.get(oidName))); - } - - String typeName = oidTypeNames.getOrDefault(oidName, oidName); -@@ -133,11 +136,8 @@ public class OidValuesCorrectnessTest extends BaseTest4 { - resultSet = stmt.getResultSet(); - - // resultSet have to have next row -- Assert.assertTrue("Oid value doesn't exist for oid " + oidName + ";with used type: " + typeName, -- resultSet.next()); -+ assertTrue(resultSet.next(), () -> "Oid value doesn't exist for oid " + oidName + ";with used type: " + typeName); - // check if expected value from a database is the same as value in Oid class -- Assert.assertEquals("Wrong value for oid: " + oidName + ";with used type: " + typeName, -- resultSet.getInt(1), oidValue); -- -+ assertEquals(resultSet.getInt(1), oidValue, () -> "Wrong value for oid: " + oidName + ";with used type: " + typeName); - } - } -diff --git a/src/test/java/org/postgresql/jdbc/BitFieldTest.java b/src/test/java/org/postgresql/jdbc/BitFieldTest.java -index d9d2a47..d87d915 100644 ---- a/src/test/java/org/postgresql/jdbc/BitFieldTest.java -+++ b/src/test/java/org/postgresql/jdbc/BitFieldTest.java -@@ -5,14 +5,15 @@ - - package org.postgresql.jdbc; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PGobject; - --import org.junit.After; --import org.junit.Assert; --import org.junit.Before; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -67,7 +68,6 @@ public class BitFieldTest extends BaseTest4 { - }; - - @Override -- @Before - public void setUp() throws Exception { - super.setUp(); - con = TestUtil.openDB(); -@@ -79,7 +79,7 @@ public class BitFieldTest extends BaseTest4 { - } - } - -- @After -+ @Override - public void tearDown() throws SQLException { - Statement stmt = con.createStatement(); - for (TestData testData : testBitValues) { -@@ -117,18 +117,18 @@ public class BitFieldTest extends BaseTest4 { - - private static void checkBitFieldValue(PreparedStatement pstmt, String bitValue, boolean isVarBit) throws SQLException { - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Object o = rs.getObject(1); - if (bitValue.length() == 1 && !isVarBit) { -- Assert.assertTrue("Failed for " + bitValue, o instanceof java.lang.Boolean); -+ assertInstanceOf(Boolean.class, o, "Failed for " + bitValue); - Boolean b = (Boolean) o; -- Assert.assertEquals("Failed for " + bitValue, bitValue.charAt(0) == '1', b); -+ assertEquals(bitValue.charAt(0) == '1', b, "Failed for " + bitValue); - } else { -- Assert.assertTrue("Failed for " + bitValue, o instanceof PGobject); -+ assertInstanceOf(PGobject.class, o, "Failed for " + bitValue); - PGobject pGobject = (PGobject) o; -- Assert.assertEquals("Failed for " + bitValue, bitValue, pGobject.getValue()); -+ assertEquals(bitValue, pGobject.getValue(), "Failed for " + bitValue); - } - String s = rs.getString(1); -- Assert.assertEquals(bitValue, s); -+ assertEquals(bitValue, s); - } - } -diff --git a/src/test/java/org/postgresql/jdbc/DeepBatchedInsertStatementTest.java b/src/test/java/org/postgresql/jdbc/DeepBatchedInsertStatementTest.java -index 6d1e796..8c4b69a 100644 ---- a/src/test/java/org/postgresql/jdbc/DeepBatchedInsertStatementTest.java -+++ b/src/test/java/org/postgresql/jdbc/DeepBatchedInsertStatementTest.java -@@ -5,7 +5,7 @@ - - package org.postgresql.jdbc; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - - import org.postgresql.PGProperty; - import org.postgresql.core.ParameterList; -@@ -15,7 +15,7 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.test.jdbc2.BatchExecuteTest; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.lang.reflect.Method; - import java.sql.Date; -diff --git a/src/test/java/org/postgresql/jdbc/LargeObjectManagerTest.java b/src/test/java/org/postgresql/jdbc/LargeObjectManagerTest.java -index 3aed4a1..7818400 100644 ---- a/src/test/java/org/postgresql/jdbc/LargeObjectManagerTest.java -+++ b/src/test/java/org/postgresql/jdbc/LargeObjectManagerTest.java -@@ -7,6 +7,7 @@ package org.postgresql.jdbc; - - import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.core.ServerVersion; -@@ -18,7 +19,6 @@ import org.postgresql.test.util.StrangeOutputStream; - import org.postgresql.util.PSQLException; - import org.postgresql.util.PSQLState; - --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.Test; - - import java.io.IOException; -@@ -42,7 +42,7 @@ class LargeObjectManagerTest { - @Test - void openWithErrorAndSubsequentParameterStatusMessageShouldLeaveConnectionInUsableStateAndUpdateParameterStatus() throws Exception { - try (PgConnection con = (PgConnection) TestUtil.openDB()) { -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_0)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_0)); - con.setAutoCommit(false); - String originalApplicationName = con.getParameterStatus("application_name"); - try (Statement statement = con.createStatement()) { -diff --git a/src/test/java/org/postgresql/jdbc/NoColumnMetadataIssue1613Test.java b/src/test/java/org/postgresql/jdbc/NoColumnMetadataIssue1613Test.java -index ea3c69b..58ad678 100644 ---- a/src/test/java/org/postgresql/jdbc/NoColumnMetadataIssue1613Test.java -+++ b/src/test/java/org/postgresql/jdbc/NoColumnMetadataIssue1613Test.java -@@ -5,13 +5,12 @@ - - package org.postgresql.jdbc; - --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Before; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.ResultSet; - import java.sql.Statement; -@@ -25,7 +24,6 @@ import java.sql.Statement; - */ - public class NoColumnMetadataIssue1613Test extends BaseTest4 { - @Override -- @Before - public void setUp() throws Exception { - super.setUp(); - TestUtil.createTempTable(con, "test_no_column_metadata", "id int"); -diff --git a/src/test/java/org/postgresql/jdbc/PgSQLXMLTest.java b/src/test/java/org/postgresql/jdbc/PgSQLXMLTest.java -index e340df9..a6b93bb 100644 ---- a/src/test/java/org/postgresql/jdbc/PgSQLXMLTest.java -+++ b/src/test/java/org/postgresql/jdbc/PgSQLXMLTest.java -@@ -5,18 +5,17 @@ - - package org.postgresql.jdbc; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; - import static org.junit.jupiter.api.Assertions.assertThrows; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.PGProperty; - import org.postgresql.core.BaseConnection; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Before; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.StringWriter; - import java.io.Writer; -@@ -42,7 +41,6 @@ import javax.xml.transform.stream.StreamResult; - public class PgSQLXMLTest extends BaseTest4 { - - @Override -- @Before - public void setUp() throws Exception { - super.setUp(); - TestUtil.createTempTable(con, "xmltab", "x xml"); -@@ -98,8 +96,8 @@ public class PgSQLXMLTest extends BaseTest4 { - }); - String message = ex.getCause().getMessage(); - assertTrue( -- "Expected to get a <> SAXParseException. Actual message is " + message, -- message.contains("DOCTYPE")); -+ message.contains("DOCTYPE"), -+ () -> "Expected to get a <> SAXParseException. Actual message is " + message); - } - - @Test -@@ -121,8 +119,8 @@ public class PgSQLXMLTest extends BaseTest4 { - }); - String message = ex.getCause().getMessage(); - assertTrue( -- "Expected to get a <> TransformerException. Actual message is " + message, -- message.contains("DOCTYPE")); -+ message.contains("DOCTYPE"), -+ () -> "Expected to get a <> TransformerException. Actual message is " + message); - } - - @Test -diff --git a/src/test/java/org/postgresql/test/annotations/tags/Slow.java b/src/test/java/org/postgresql/test/annotations/tags/Slow.java -new file mode 100644 -index 0000000..8ef0b2e ---- /dev/null -+++ b/src/test/java/org/postgresql/test/annotations/tags/Slow.java -@@ -0,0 +1,19 @@ -+/* -+ * Copyright (c) 2024, PostgreSQL Global Development Group -+ * See the LICENSE file in the project root for more information. -+ */ -+ -+package org.postgresql.test.annotations.tags; -+ -+import org.junit.jupiter.api.Tag; -+ -+import java.lang.annotation.ElementType; -+import java.lang.annotation.Retention; -+import java.lang.annotation.RetentionPolicy; -+import java.lang.annotation.Target; -+ -+@Target({ElementType.TYPE, ElementType.METHOD}) -+@Retention(RetentionPolicy.RUNTIME) -+@Tag("slow") -+public @interface Slow { -+} -diff --git a/src/test/java/org/postgresql/test/core/LogServerMessagePropertyTest.java b/src/test/java/org/postgresql/test/core/LogServerMessagePropertyTest.java -index 527117a..c46d45d 100644 ---- a/src/test/java/org/postgresql/test/core/LogServerMessagePropertyTest.java -+++ b/src/test/java/org/postgresql/test/core/LogServerMessagePropertyTest.java -@@ -7,13 +7,13 @@ package org.postgresql.test.core; - - import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLState; - --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.Test; - - import java.sql.Connection; -@@ -40,7 +40,7 @@ class LogServerMessagePropertyTest { - */ - private static String testViolatePrimaryKey(Properties props, boolean batch) throws SQLException { - Connection conn = TestUtil.openDB(props); -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v9_1)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v9_1)); - try { - TestUtil.execute(conn, CREATE_TABLE_SQL); - if (batch) { -diff --git a/src/test/java/org/postgresql/test/core/NativeQueryBindLengthTest.java b/src/test/java/org/postgresql/test/core/NativeQueryBindLengthTest.java -index c333a2c..7448ae1 100644 ---- a/src/test/java/org/postgresql/test/core/NativeQueryBindLengthTest.java -+++ b/src/test/java/org/postgresql/test/core/NativeQueryBindLengthTest.java -@@ -5,33 +5,23 @@ - - package org.postgresql.test.core; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ - import org.postgresql.core.NativeQuery; --import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.params.ParameterizedTest; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.util.ArrayList; - import java.util.List; - --@RunWith(Parameterized.class) --public class NativeQueryBindLengthTest extends BaseTest4 { -- private final int expected; -- private final int bindCount; -- -- public NativeQueryBindLengthTest(String name, int expected, int bindCount) { -- this.expected = expected; -- this.bindCount = bindCount; -- } -- -- @Test -- public void testBindLengthCalculation() { -- Assert.assertEquals(expected, NativeQuery.calculateBindLength(bindCount)); -+public class NativeQueryBindLengthTest { -+ @ParameterizedTest(name = "{0} == {1}") -+ @MethodSource("data") -+ public void testBindLengthCalculation(String name, int expected, int bindCount) { -+ assertEquals(expected, NativeQuery.calculateBindLength(bindCount)); - } - -- @Parameterized.Parameters(name = "{0} == {1}") - public static Iterable data() { - List res = new ArrayList<>(); - res.add(new Object[]{"'$1'.length = 2", 2, 1}); -diff --git a/src/test/java/org/postgresql/test/core/QueryExecutorTest.java b/src/test/java/org/postgresql/test/core/QueryExecutorTest.java -index 3381def..1211e82 100644 ---- a/src/test/java/org/postgresql/test/core/QueryExecutorTest.java -+++ b/src/test/java/org/postgresql/test/core/QueryExecutorTest.java -@@ -9,7 +9,7 @@ import org.postgresql.core.BaseConnection; - import org.postgresql.core.QueryExecutor; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.SQLException; - import java.util.Set; -diff --git a/src/test/java/org/postgresql/test/extensions/HStoreTest.java b/src/test/java/org/postgresql/test/extensions/HStoreTest.java -index 5db06f5..5f2f51b 100644 ---- a/src/test/java/org/postgresql/test/extensions/HStoreTest.java -+++ b/src/test/java/org/postgresql/test/extensions/HStoreTest.java -@@ -5,16 +5,17 @@ - - package org.postgresql.test.extensions; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeFalse; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Connection; - import java.sql.PreparedStatement; -@@ -34,9 +35,8 @@ public class HStoreTest extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("server has installed hstore", isHStoreEnabled(con)); -- Assume.assumeFalse("hstore is not supported in simple protocol only mode", -- preferQueryMode == PreferQueryMode.SIMPLE); -+ assumeTrue(isHStoreEnabled(con), "server has installed hstore"); -+ assumeFalse(preferQueryMode == PreferQueryMode.SIMPLE, "hstore is not supported in simple protocol only mode"); - assumeMinimumServerVersion("hstore requires PostgreSQL 8.3+", ServerVersion.v8_3); - } - -diff --git a/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java b/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java -index c5179bb..952b22c 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java -@@ -5,8 +5,11 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGConnection; - import org.postgresql.core.BaseConnection; -@@ -18,10 +21,9 @@ import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLException; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.math.BigDecimal; - import java.sql.Array; -@@ -37,7 +39,8 @@ import java.sql.Types; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class ArrayTest extends BaseTest4 { - private Connection conn; - -@@ -45,7 +48,6 @@ public class ArrayTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -100,10 +102,10 @@ public class ArrayTest extends BaseTest4 { - - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT intarr, decarr, strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.INTEGER, arr.getBaseType()); -+ assertEquals(Types.INTEGER, arr.getBaseType()); - Integer[] intarr = (Integer[]) arr.getArray(); - assertEquals(3, intarr.length); - assertEquals(1, intarr[0].intValue()); -@@ -161,7 +163,7 @@ public class ArrayTest extends BaseTest4 { - - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT intarr[1], decarr[1], strarr[1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -182,7 +184,7 @@ public class ArrayTest extends BaseTest4 { - - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT intarr[1], decarr[1], strarr[1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -203,7 +205,7 @@ public class ArrayTest extends BaseTest4 { - - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT intarr[1][1], decarr[1][1], strarr[1][1], intarr[2][1], decarr[2][1], strarr[2][1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -227,7 +229,7 @@ public class ArrayTest extends BaseTest4 { - - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT intarr[1][1], decarr[1][1], strarr[1][1], intarr[2][1], decarr[2][1], strarr[2][1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -252,7 +254,7 @@ public class ArrayTest extends BaseTest4 { - - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT intarr[1][1][1], decarr[1][1][1], strarr[1][1][1], intarr[2][1][1], decarr[2][1][1], strarr[2][1][1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -277,7 +279,7 @@ public class ArrayTest extends BaseTest4 { - - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT intarr[1][1][1], decarr[1][1][1], strarr[1][1][1], intarr[2][1][1], decarr[2][1][1], strarr[2][1][1] FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - assertEquals(origIntArray[0][0][0], rs.getInt(1)); - assertEquals(origDblArray[0][0][0], rs.getDouble(2), 0.001); -@@ -304,29 +306,29 @@ public class ArrayTest extends BaseTest4 { - - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT intarr, decarr, strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.INTEGER, arr.getBaseType()); -+ assertEquals(Types.INTEGER, arr.getBaseType()); - Integer[] intarr = (Integer[]) arr.getArray(); -- Assert.assertEquals(3, intarr.length); -- Assert.assertEquals(1, intarr[0].intValue()); -- Assert.assertEquals(2, intarr[1].intValue()); -- Assert.assertEquals(3, intarr[2].intValue()); -+ assertEquals(3, intarr.length); -+ assertEquals(1, intarr[0].intValue()); -+ assertEquals(2, intarr[1].intValue()); -+ assertEquals(3, intarr[2].intValue()); - - arr = rs.getArray(2); -- Assert.assertEquals(Types.NUMERIC, arr.getBaseType()); -+ assertEquals(Types.NUMERIC, arr.getBaseType()); - BigDecimal[] decarr = (BigDecimal[]) arr.getArray(); -- Assert.assertEquals(2, decarr.length); -- Assert.assertEquals(new BigDecimal("3.1"), decarr[0]); -- Assert.assertEquals(new BigDecimal("1.4"), decarr[1]); -+ assertEquals(2, decarr.length); -+ assertEquals(new BigDecimal("3.1"), decarr[0]); -+ assertEquals(new BigDecimal("1.4"), decarr[1]); - - arr = rs.getArray(3); -- Assert.assertEquals(Types.VARCHAR, arr.getBaseType()); -+ assertEquals(Types.VARCHAR, arr.getBaseType()); - String[] strarr = (String[]) arr.getArray(2, 2); -- Assert.assertEquals(2, strarr.length); -- Assert.assertEquals("f'a", strarr[0]); -- Assert.assertEquals("fa\"b", strarr[1]); -+ assertEquals(2, strarr.length); -+ assertEquals("f'a", strarr[0]); -+ assertEquals("fa\"b", strarr[1]); - - try { - arraySupport.createArrayOf("int4", 1); -@@ -383,50 +385,50 @@ public class ArrayTest extends BaseTest4 { - ResultSet rs = - stmt.executeQuery( - "SELECT floats, reals, varchars, times, timestamps, timestampstz FROM ansiarraytest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.DOUBLE, arr.getBaseType()); -+ assertEquals(Types.DOUBLE, arr.getBaseType()); - Double[] doubles = (Double[]) arr.getArray(); -- Assert.assertEquals(2, doubles.length); -- Assert.assertEquals(1d, doubles[0], 0); -- Assert.assertEquals(4d, doubles[1], 0); -+ assertEquals(2, doubles.length); -+ assertEquals(1d, doubles[0], 0); -+ assertEquals(4d, doubles[1], 0); - - arr = rs.getArray(2); -- Assert.assertEquals(Types.REAL, arr.getBaseType()); -+ assertEquals(Types.REAL, arr.getBaseType()); - Float[] floats = (Float[]) arr.getArray(); -- Assert.assertEquals(2, floats.length); -- Assert.assertEquals(0f, floats[0], 0); -- Assert.assertEquals(3f, floats[1], 0); -+ assertEquals(2, floats.length); -+ assertEquals(0f, floats[0], 0); -+ assertEquals(3f, floats[1], 0); - - arr = rs.getArray(3); -- Assert.assertEquals(Types.VARCHAR, arr.getBaseType()); -+ assertEquals(Types.VARCHAR, arr.getBaseType()); - String[] strings = (String[]) arr.getArray(); -- Assert.assertEquals(3, strings.length); -- Assert.assertEquals("abc", strings[0]); -- Assert.assertEquals("f'a", strings[1]); -- Assert.assertEquals("fa\"b", strings[2]); -+ assertEquals(3, strings.length); -+ assertEquals("abc", strings[0]); -+ assertEquals("f'a", strings[1]); -+ assertEquals("fa\"b", strings[2]); - - arr = rs.getArray(4); -- Assert.assertEquals(Types.TIME, arr.getBaseType()); -+ assertEquals(Types.TIME, arr.getBaseType()); - Time[] times = (Time[]) arr.getArray(); -- Assert.assertEquals(2, times.length); -- Assert.assertEquals(Time.valueOf("12:34:56"), times[0]); -- Assert.assertEquals(Time.valueOf("03:30:25"), times[1]); -+ assertEquals(2, times.length); -+ assertEquals(Time.valueOf("12:34:56"), times[0]); -+ assertEquals(Time.valueOf("03:30:25"), times[1]); - - arr = rs.getArray(5); -- Assert.assertEquals(Types.TIMESTAMP, arr.getBaseType()); -+ assertEquals(Types.TIMESTAMP, arr.getBaseType()); - Timestamp[] tzarr = (Timestamp[]) arr.getArray(); -- Assert.assertEquals(2, times.length); -- Assert.assertEquals(Timestamp.valueOf("2023-09-05 16:21:50"), tzarr[0]); -- Assert.assertEquals(Timestamp.valueOf("2012-01-01 13:02:03"), tzarr[1]); -+ assertEquals(2, times.length); -+ assertEquals(Timestamp.valueOf("2023-09-05 16:21:50"), tzarr[0]); -+ assertEquals(Timestamp.valueOf("2012-01-01 13:02:03"), tzarr[1]); - - arr = rs.getArray(6); -- Assert.assertEquals(Types.TIMESTAMP, arr.getBaseType()); -+ assertEquals(Types.TIMESTAMP, arr.getBaseType()); - tzarr = (Timestamp[]) arr.getArray(); -- Assert.assertEquals(2, times.length); -- Assert.assertEquals(822427200000L, tzarr[0].getTime()); -- Assert.assertEquals(871764660000L, tzarr[1].getTime()); -+ assertEquals(2, times.length); -+ assertEquals(822427200000L, tzarr[0].getTime()); -+ assertEquals(871764660000L, tzarr[1].getTime()); - - rs.close(); - } finally { -@@ -449,16 +451,16 @@ public class ArrayTest extends BaseTest4 { - - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT intarr, decarr, strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertNull(arr); -+ assertNull(arr); - - arr = rs.getArray(2); -- Assert.assertNull(arr); -+ assertNull(arr); - - arr = rs.getArray(3); -- Assert.assertNull(arr); -+ assertNull(arr); - - rs.close(); - } -@@ -472,29 +474,29 @@ public class ArrayTest extends BaseTest4 { - + TestUtil.escapeString(conn, "{abc,f'a,\"fa\\\"b\",def, un quot\u000B \u2001 \r}") + "')"); - - ResultSet rs = stmt.executeQuery("SELECT intarr, decarr, strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.INTEGER, arr.getBaseType()); -+ assertEquals(Types.INTEGER, arr.getBaseType()); - Integer[] intarr = (Integer[]) arr.getArray(); -- Assert.assertEquals(3, intarr.length); -- Assert.assertEquals(1, intarr[0].intValue()); -- Assert.assertEquals(2, intarr[1].intValue()); -- Assert.assertEquals(3, intarr[2].intValue()); -+ assertEquals(3, intarr.length); -+ assertEquals(1, intarr[0].intValue()); -+ assertEquals(2, intarr[1].intValue()); -+ assertEquals(3, intarr[2].intValue()); - - arr = rs.getArray(2); -- Assert.assertEquals(Types.NUMERIC, arr.getBaseType()); -+ assertEquals(Types.NUMERIC, arr.getBaseType()); - BigDecimal[] decarr = (BigDecimal[]) arr.getArray(); -- Assert.assertEquals(2, decarr.length); -- Assert.assertEquals(new BigDecimal("3.1"), decarr[0]); -- Assert.assertEquals(new BigDecimal("1.4"), decarr[1]); -+ assertEquals(2, decarr.length); -+ assertEquals(new BigDecimal("3.1"), decarr[0]); -+ assertEquals(new BigDecimal("1.4"), decarr[1]); - - arr = rs.getArray(3); -- Assert.assertEquals(Types.VARCHAR, arr.getBaseType()); -+ assertEquals(Types.VARCHAR, arr.getBaseType()); - String[] strarr = (String[]) arr.getArray(2, 2); -- Assert.assertEquals(2, strarr.length); -- Assert.assertEquals("f'a", strarr[0]); -- Assert.assertEquals("fa\"b", strarr[1]); -+ assertEquals(2, strarr.length); -+ assertEquals("f'a", strarr[0]); -+ assertEquals("fa\"b", strarr[1]); - - strarr = (String[]) arr.getArray(); - assertEquals(5, strarr.length); -@@ -514,53 +516,53 @@ public class ArrayTest extends BaseTest4 { - + TestUtil.escapeString(conn, "{\"a\u2001b\",f'a,\"fa\\\"b\",def}") + "')"); - - ResultSet rs = stmt.executeQuery("SELECT intarr, decarr, strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.INTEGER, arr.getBaseType()); -+ assertEquals(Types.INTEGER, arr.getBaseType()); - ResultSet arrrs = arr.getResultSet(); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(1, arrrs.getInt(1)); -- Assert.assertEquals(1, arrrs.getInt(2)); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(2, arrrs.getInt(1)); -- Assert.assertEquals(2, arrrs.getInt(2)); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(3, arrrs.getInt(1)); -- Assert.assertEquals(3, arrrs.getInt(2)); -- Assert.assertTrue(!arrrs.next()); -- Assert.assertTrue(arrrs.previous()); -- Assert.assertEquals(3, arrrs.getInt(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(1, arrrs.getInt(1)); -+ assertEquals(1, arrrs.getInt(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(2, arrrs.getInt(1)); -+ assertEquals(2, arrrs.getInt(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(3, arrrs.getInt(1)); -+ assertEquals(3, arrrs.getInt(2)); -+ assertFalse(arrrs.next()); -+ assertTrue(arrrs.previous()); -+ assertEquals(3, arrrs.getInt(2)); - arrrs.first(); -- Assert.assertEquals(1, arrrs.getInt(2)); -+ assertEquals(1, arrrs.getInt(2)); - arrrs.close(); - - arr = rs.getArray(2); -- Assert.assertEquals(Types.NUMERIC, arr.getBaseType()); -+ assertEquals(Types.NUMERIC, arr.getBaseType()); - arrrs = arr.getResultSet(); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(new BigDecimal("3.1"), arrrs.getBigDecimal(2)); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(new BigDecimal("1.4"), arrrs.getBigDecimal(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(new BigDecimal("3.1"), arrrs.getBigDecimal(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(new BigDecimal("1.4"), arrrs.getBigDecimal(2)); - arrrs.close(); - - arr = rs.getArray(3); -- Assert.assertEquals(Types.VARCHAR, arr.getBaseType()); -+ assertEquals(Types.VARCHAR, arr.getBaseType()); - arrrs = arr.getResultSet(2, 2); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(2, arrrs.getInt(1)); -- Assert.assertEquals("f'a", arrrs.getString(2)); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(3, arrrs.getInt(1)); -- Assert.assertEquals("fa\"b", arrrs.getString(2)); -- Assert.assertTrue(!arrrs.next()); -+ assertTrue(arrrs.next()); -+ assertEquals(2, arrrs.getInt(1)); -+ assertEquals("f'a", arrrs.getString(2)); -+ assertTrue(arrrs.next()); -+ assertEquals(3, arrrs.getInt(1)); -+ assertEquals("fa\"b", arrrs.getString(2)); -+ assertFalse(arrrs.next()); - arrrs.close(); - - arrrs = arr.getResultSet(1, 1); -- Assert.assertTrue(arrrs.next()); -- Assert.assertEquals(1, arrrs.getInt(1)); -- Assert.assertEquals(stringWithNonAsciiWhiteSpace, arrrs.getString(2)); -- Assert.assertFalse(arrrs.next()); -+ assertTrue(arrrs.next()); -+ assertEquals(1, arrrs.getInt(1)); -+ assertEquals(stringWithNonAsciiWhiteSpace, arrrs.getString(2)); -+ assertFalse(arrrs.next()); - arrrs.close(); - - rs.close(); -@@ -571,7 +573,7 @@ public class ArrayTest extends BaseTest4 { - public void testSetArray() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet arrRS = stmt.executeQuery("SELECT '{1,2,3}'::int4[]"); -- Assert.assertTrue(arrRS.next()); -+ assertTrue(arrRS.next()); - Array arr = arrRS.getArray(1); - arrRS.close(); - stmt.close(); -@@ -594,16 +596,16 @@ public class ArrayTest extends BaseTest4 { - while (rs.next()) { - resultCount++; - Array result = rs.getArray(1); -- Assert.assertEquals(Types.INTEGER, result.getBaseType()); -- Assert.assertEquals("int4", result.getBaseTypeName()); -+ assertEquals(Types.INTEGER, result.getBaseType()); -+ assertEquals("int4", result.getBaseTypeName()); - - Integer[] intarr = (Integer[]) result.getArray(); -- Assert.assertEquals(3, intarr.length); -- Assert.assertEquals(1, intarr[0].intValue()); -- Assert.assertEquals(2, intarr[1].intValue()); -- Assert.assertEquals(3, intarr[2].intValue()); -+ assertEquals(3, intarr.length); -+ assertEquals(1, intarr[0].intValue()); -+ assertEquals(2, intarr[1].intValue()); -+ assertEquals(3, intarr[2].intValue()); - } -- Assert.assertEquals(3, resultCount); -+ assertEquals(3, resultCount); - } - - /** -@@ -617,12 +619,12 @@ public class ArrayTest extends BaseTest4 { - stmt.executeUpdate("INSERT INTO arrtest (intarr) VALUES ('{1,2,3}')"); - stmt.executeUpdate("UPDATE arrtest SET intarr[0] = 0"); - ResultSet rs = stmt.executeQuery("SELECT intarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array result = rs.getArray(1); - Integer[] intarr = (Integer[]) result.getArray(); -- Assert.assertEquals(4, intarr.length); -+ assertEquals(4, intarr.length); - for (int i = 0; i < intarr.length; i++) { -- Assert.assertEquals(i, intarr[i].intValue()); -+ assertEquals(i, intarr[i].intValue()); - } - } - -@@ -630,18 +632,18 @@ public class ArrayTest extends BaseTest4 { - public void testMultiDimensionalArray() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT '{{1,2},{3,4}}'::int[]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Object[] oa = (Object[]) arr.getArray(); -- Assert.assertEquals(2, oa.length); -+ assertEquals(2, oa.length); - Integer[] i0 = (Integer[]) oa[0]; -- Assert.assertEquals(2, i0.length); -- Assert.assertEquals(1, i0[0].intValue()); -- Assert.assertEquals(2, i0[1].intValue()); -+ assertEquals(2, i0.length); -+ assertEquals(1, i0[0].intValue()); -+ assertEquals(2, i0[1].intValue()); - Integer[] i1 = (Integer[]) oa[1]; -- Assert.assertEquals(2, i1.length); -- Assert.assertEquals(3, i1[0].intValue()); -- Assert.assertEquals(4, i1[1].intValue()); -+ assertEquals(2, i1.length); -+ assertEquals(3, i1[0].intValue()); -+ assertEquals(4, i1[1].intValue()); - rs.close(); - stmt.close(); - } -@@ -650,19 +652,19 @@ public class ArrayTest extends BaseTest4 { - public void testNullValues() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT ARRAY[1,NULL,3]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Integer[] i = (Integer[]) arr.getArray(); -- Assert.assertEquals(3, i.length); -- Assert.assertEquals(1, i[0].intValue()); -- Assert.assertNull(i[1]); -- Assert.assertEquals(3, i[2].intValue()); -+ assertEquals(3, i.length); -+ assertEquals(1, i[0].intValue()); -+ assertNull(i[1]); -+ assertEquals(3, i[2].intValue()); - } - - @Test - public void testNullFieldString() throws SQLException { - Array arr = new PgArray((BaseConnection) conn, 1, (String) null); -- Assert.assertNull(arr.toString()); -+ assertNull(arr.toString()); - } - - @Test -@@ -690,10 +692,10 @@ public class ArrayTest extends BaseTest4 { - stmt.executeUpdate("INSERT INTO arrtest VALUES (NULL, NULL, '" + TestUtil.escapeString(conn, stringArray) + "')"); - - final ResultSet rs = stmt.executeQuery("SELECT strarr FROM arrtest"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); -- Assert.assertEquals(Types.VARCHAR, arr.getBaseType()); -+ assertEquals(Types.VARCHAR, arr.getBaseType()); - String[] strarr = (String[]) arr.getArray(); - assertEquals(5, strarr.length); - assertEquals("f'a", strarr[0]); -@@ -728,54 +730,54 @@ public class ArrayTest extends BaseTest4 { - ResultSet rs = - stmt.executeQuery("SELECT relacl FROM pg_class WHERE relacl IS NOT NULL LIMIT 1"); - ResultSetMetaData rsmd = rs.getMetaData(); -- Assert.assertEquals(Types.ARRAY, rsmd.getColumnType(1)); -+ assertEquals(Types.ARRAY, rsmd.getColumnType(1)); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); -- Assert.assertEquals("aclitem", arr.getBaseTypeName()); -+ assertEquals("aclitem", arr.getBaseTypeName()); - - ResultSet arrRS = arr.getResultSet(); - ResultSetMetaData arrRSMD = arrRS.getMetaData(); -- Assert.assertEquals("aclitem", arrRSMD.getColumnTypeName(2)); -+ assertEquals("aclitem", arrRSMD.getColumnTypeName(2)); - } - - @Test - public void testRecursiveResultSets() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT '{{1,2},{3,4}}'::int[]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - - ResultSet arrRS = arr.getResultSet(); - ResultSetMetaData arrRSMD = arrRS.getMetaData(); -- Assert.assertEquals(Types.ARRAY, arrRSMD.getColumnType(2)); -- Assert.assertEquals("_int4", arrRSMD.getColumnTypeName(2)); -+ assertEquals(Types.ARRAY, arrRSMD.getColumnType(2)); -+ assertEquals("_int4", arrRSMD.getColumnTypeName(2)); - -- Assert.assertTrue(arrRS.next()); -- Assert.assertEquals(1, arrRS.getInt(1)); -+ assertTrue(arrRS.next()); -+ assertEquals(1, arrRS.getInt(1)); - Array a1 = arrRS.getArray(2); - ResultSet a1RS = a1.getResultSet(); - ResultSetMetaData a1RSMD = a1RS.getMetaData(); -- Assert.assertEquals(Types.INTEGER, a1RSMD.getColumnType(2)); -- Assert.assertEquals("int4", a1RSMD.getColumnTypeName(2)); -- -- Assert.assertTrue(a1RS.next()); -- Assert.assertEquals(1, a1RS.getInt(2)); -- Assert.assertTrue(a1RS.next()); -- Assert.assertEquals(2, a1RS.getInt(2)); -- Assert.assertTrue(!a1RS.next()); -+ assertEquals(Types.INTEGER, a1RSMD.getColumnType(2)); -+ assertEquals("int4", a1RSMD.getColumnTypeName(2)); -+ -+ assertTrue(a1RS.next()); -+ assertEquals(1, a1RS.getInt(2)); -+ assertTrue(a1RS.next()); -+ assertEquals(2, a1RS.getInt(2)); -+ assertFalse(a1RS.next()); - a1RS.close(); - -- Assert.assertTrue(arrRS.next()); -- Assert.assertEquals(2, arrRS.getInt(1)); -+ assertTrue(arrRS.next()); -+ assertEquals(2, arrRS.getInt(1)); - Array a2 = arrRS.getArray(2); - ResultSet a2RS = a2.getResultSet(); - -- Assert.assertTrue(a2RS.next()); -- Assert.assertEquals(3, a2RS.getInt(2)); -- Assert.assertTrue(a2RS.next()); -- Assert.assertEquals(4, a2RS.getInt(2)); -- Assert.assertTrue(!a2RS.next()); -+ assertTrue(a2RS.next()); -+ assertEquals(3, a2RS.getInt(2)); -+ assertTrue(a2RS.next()); -+ assertEquals(4, a2RS.getInt(2)); -+ assertFalse(a2RS.next()); - a2RS.close(); - - arrRS.close(); -@@ -787,13 +789,13 @@ public class ArrayTest extends BaseTest4 { - public void testNullString() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT '{a,NULL}'::text[]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - - String[] s = (String[]) arr.getArray(); -- Assert.assertEquals(2, s.length); -- Assert.assertEquals("a", s[0]); -- Assert.assertNull(s[1]); -+ assertEquals(2, s.length); -+ assertEquals("a", s[0]); -+ assertNull(s[1]); - } - - @Test -@@ -805,41 +807,41 @@ public class ArrayTest extends BaseTest4 { - sql += "'{{c\\\\\"d, ''}, {\"\\\\\\\\\",\"''\"}}'::text[]"; - - ResultSet rs = stmt.executeQuery(sql); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array arr = rs.getArray(1); - String[][] s = (String[][]) arr.getArray(); -- Assert.assertEquals("c\"d", s[0][0]); -- Assert.assertEquals("'", s[0][1]); -- Assert.assertEquals("\\", s[1][0]); -- Assert.assertEquals("'", s[1][1]); -+ assertEquals("c\"d", s[0][0]); -+ assertEquals("'", s[0][1]); -+ assertEquals("\\", s[1][0]); -+ assertEquals("'", s[1][1]); - - ResultSet arrRS = arr.getResultSet(); - -- Assert.assertTrue(arrRS.next()); -+ assertTrue(arrRS.next()); - Array a1 = arrRS.getArray(2); - ResultSet rs1 = a1.getResultSet(); -- Assert.assertTrue(rs1.next()); -- Assert.assertEquals("c\"d", rs1.getString(2)); -- Assert.assertTrue(rs1.next()); -- Assert.assertEquals("'", rs1.getString(2)); -- Assert.assertTrue(!rs1.next()); -+ assertTrue(rs1.next()); -+ assertEquals("c\"d", rs1.getString(2)); -+ assertTrue(rs1.next()); -+ assertEquals("'", rs1.getString(2)); -+ assertFalse(rs1.next()); - -- Assert.assertTrue(arrRS.next()); -+ assertTrue(arrRS.next()); - Array a2 = arrRS.getArray(2); - ResultSet rs2 = a2.getResultSet(); -- Assert.assertTrue(rs2.next()); -- Assert.assertEquals("\\", rs2.getString(2)); -- Assert.assertTrue(rs2.next()); -- Assert.assertEquals("'", rs2.getString(2)); -- Assert.assertTrue(!rs2.next()); -+ assertTrue(rs2.next()); -+ assertEquals("\\", rs2.getString(2)); -+ assertTrue(rs2.next()); -+ assertEquals("'", rs2.getString(2)); -+ assertFalse(rs2.next()); - } - - @Test - public void testWriteMultiDimensional() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT '{{1,2},{3,4}}'::int[]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - rs.close(); - stmt.close(); -@@ -851,14 +853,14 @@ public class ArrayTest extends BaseTest4 { - PreparedStatement pstmt = conn.prepareStatement(sql); - pstmt.setArray(1, arr); - rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - arr = rs.getArray(1); - - Integer[][] i = (Integer[][]) arr.getArray(); -- Assert.assertEquals(1, i[0][0].intValue()); -- Assert.assertEquals(2, i[0][1].intValue()); -- Assert.assertEquals(3, i[1][0].intValue()); -- Assert.assertEquals(4, i[1][1].intValue()); -+ assertEquals(1, i[0][0].intValue()); -+ assertEquals(2, i[0][1].intValue()); -+ assertEquals(3, i[1][0].intValue()); -+ assertEquals(4, i[1][1].intValue()); - } - - /* -@@ -869,24 +871,24 @@ public class ArrayTest extends BaseTest4 { - public void testNonStandardDelimiter() throws SQLException { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT '{(3,4),(1,2);(7,8),(5,6)}'::box[]"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - - ResultSet arrRS = arr.getResultSet(); - -- Assert.assertTrue(arrRS.next()); -+ assertTrue(arrRS.next()); - PGbox box1 = (PGbox) arrRS.getObject(2); - PGpoint p1 = box1.point[0]; -- Assert.assertEquals(3, p1.x, 0.001); -- Assert.assertEquals(4, p1.y, 0.001); -+ assertEquals(3, p1.x, 0.001); -+ assertEquals(4, p1.y, 0.001); - -- Assert.assertTrue(arrRS.next()); -+ assertTrue(arrRS.next()); - PGbox box2 = (PGbox) arrRS.getObject(2); - PGpoint p2 = box2.point[1]; -- Assert.assertEquals(5, p2.x, 0.001); -- Assert.assertEquals(6, p2.y, 0.001); -+ assertEquals(5, p2.x, 0.001); -+ assertEquals(6, p2.y, 0.001); - -- Assert.assertTrue(!arrRS.next()); -+ assertFalse(arrRS.next()); - } - - @Test -@@ -898,8 +900,10 @@ public class ArrayTest extends BaseTest4 { - Array array = rs.getArray(1); - if (!rs.wasNull()) { - ResultSet ars = array.getResultSet(); -- Assert.assertEquals("get columntype should return Types.INTEGER", java.sql.Types.INTEGER, -- ars.getMetaData().getColumnType(1)); -+ assertEquals( -+ Types.INTEGER, -+ ars.getMetaData().getColumnType(1), -+ "get columntype should return Types.INTEGER"); - } - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTest.java b/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTest.java -index 5915444..08a9675 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTest.java -@@ -5,6 +5,12 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; -+ - import org.postgresql.PGConnection; - import org.postgresql.PGProperty; - import org.postgresql.core.BaseConnection; -@@ -17,11 +23,9 @@ import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -33,7 +37,8 @@ import java.util.EnumSet; - import java.util.Properties; - import java.util.concurrent.atomic.AtomicInteger; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "{index}: autorollback(autoSave={0}, cleanSavePoint={1}, autoCommit={2}, failMode={3}, continueMode={4}, flushOnDeallocate={5}, hastransaction={6}, sql={7}, columns={8})") -+@MethodSource("data") - public class AutoRollbackTest extends BaseTest4 { - private static final AtomicInteger counter = new AtomicInteger(); - -@@ -150,12 +155,9 @@ public class AutoRollbackTest extends BaseTest4 { - con.setAutoCommit(autoCommit == AutoCommit.YES); - BaseConnection baseConnection = con.unwrap(BaseConnection.class); - baseConnection.setFlushCacheOnDeallocate(flushCacheOnDeallocate); -- Assume.assumeTrue("DEALLOCATE ALL requires PostgreSQL 8.3+", -- failMode != FailMode.DEALLOCATE || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); -- Assume.assumeTrue("DISCARD ALL requires PostgreSQL 8.3+", -- failMode != FailMode.DISCARD || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); -- Assume.assumeTrue("Plan invalidation on table redefinition requires PostgreSQL 8.3+", -- failMode != FailMode.ALTER || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); -+ assumeTrue(failMode != FailMode.DEALLOCATE || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3), "DEALLOCATE ALL requires PostgreSQL 8.3+"); -+ assumeTrue(failMode != FailMode.DISCARD || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3), "DISCARD ALL requires PostgreSQL 8.3+"); -+ assumeTrue(failMode != FailMode.ALTER || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3), "Plan invalidation on table redefinition requires PostgreSQL 8.3+"); - } - - @Override -@@ -177,7 +179,6 @@ public class AutoRollbackTest extends BaseTest4 { - PGProperty.PREPARE_THRESHOLD.set(props, 1); - } - -- @Parameterized.Parameters(name = "{index}: autorollback(autoSave={0}, cleanSavePoint={1}, autoCommit={2}, failMode={3}, continueMode={4}, flushOnDeallocate={5}, hastransaction={6}, sql={7}, columns={8})") - public static Iterable data() { - Collection ids = new ArrayList<>(); - boolean[] booleans = new boolean[]{true, false}; -@@ -249,10 +250,9 @@ public class AutoRollbackTest extends BaseTest4 { - case SELECT: - try { - statement.execute("select 1/0"); -- Assert.fail("select 1/0 should fail"); -+ fail("select 1/0 should fail"); - } catch (SQLException e) { -- Assert.assertEquals("division by zero expected", -- PSQLState.DIVISION_BY_ZERO.getState(), e.getSQLState()); -+ assertEquals(PSQLState.DIVISION_BY_ZERO.getState(), e.getSQLState(), "division by zero expected"); - } - break; - case DEALLOCATE: -@@ -268,24 +268,21 @@ public class AutoRollbackTest extends BaseTest4 { - try { - statement.addBatch("insert into rollbacktest(a, str) values (1/0, 'test')"); - statement.executeBatch(); -- Assert.fail("select 1/0 should fail"); -+ fail("select 1/0 should fail"); - } catch (SQLException e) { -- Assert.assertEquals("division by zero expected", -- PSQLState.DIVISION_BY_ZERO.getState(), e.getSQLState()); -+ assertEquals(PSQLState.DIVISION_BY_ZERO.getState(), e.getSQLState(), "division by zero expected"); - } - break; - default: -- Assert.fail("Fail mode " + failMode + " is not implemented"); -+ fail("Fail mode " + failMode + " is not implemented"); - } - - PgConnection pgConnection = con.unwrap(PgConnection.class); - if (autoSave == AutoSave.ALWAYS) { -- Assert.assertNotEquals("In AutoSave.ALWAYS, transaction should not fail", -- TransactionState.FAILED, pgConnection.getTransactionState()); -+ assertNotEquals(TransactionState.FAILED, pgConnection.getTransactionState(), "In AutoSave.ALWAYS, transaction should not fail"); - } - if (autoCommit == AutoCommit.NO) { -- Assert.assertNotEquals("AutoCommit == NO, thus transaction should be active (open or failed)", -- TransactionState.IDLE, pgConnection.getTransactionState()); -+ assertNotEquals(TransactionState.IDLE, pgConnection.getTransactionState(), "AutoCommit == NO, thus transaction should be active (open or failed)"); - } - statement.close(); - -@@ -297,18 +294,19 @@ public class AutoRollbackTest extends BaseTest4 { - } catch (SQLException e) { - if (!flushCacheOnDeallocate && DEALLOCATES.contains(failMode) - && autoSave == AutoSave.NEVER) { -- Assert.assertEquals( -- "flushCacheOnDeallocate is disabled, thus " + failMode + " should cause 'prepared statement \"...\" does not exist'" -- + " error message is " + e.getMessage(), -- PSQLState.INVALID_SQL_STATEMENT_NAME.getState(), e.getSQLState()); -+ assertEquals( -+ PSQLState.INVALID_SQL_STATEMENT_NAME.getState(), -+ e.getSQLState(), -+ () -> "flushCacheOnDeallocate is disabled, thus " + failMode + " should cause " -+ + "'prepared statement \"...\" does not exist'" -+ + " error message is " + e.getMessage()); - return; - } - throw e; - } - return; - case IS_VALID: -- Assert.assertTrue("Connection.isValid should return true unless the connection is closed", -- con.isValid(4)); -+ assertTrue(con.isValid(4), "Connection.isValid should return true unless the connection is closed as .isValid should use simple queries only which should not fail in face of prepared statement failures"); - return; - default: - break; -@@ -321,25 +319,19 @@ public class AutoRollbackTest extends BaseTest4 { - executeSqlSuccess(); - } catch (SQLException e) { - if (autoSave != AutoSave.ALWAYS && TRANS_KILLERS.contains(failMode) && autoCommit == AutoCommit.NO) { -- Assert.assertEquals( -- "AutoSave==" + autoSave + ", thus statements should fail with 'current transaction is aborted...', " -- + " error message is " + e.getMessage(), -- PSQLState.IN_FAILED_SQL_TRANSACTION.getState(), e.getSQLState()); -+ assertEquals(PSQLState.IN_FAILED_SQL_TRANSACTION.getState(), e.getSQLState(), "AutoSave==" + autoSave + ", thus statements should fail with 'current transaction is aborted...', " -+ + " error message is " + e.getMessage()); - return; - } - - if (autoSave == AutoSave.NEVER && autoCommit == AutoCommit.NO) { - if (DEALLOCATES.contains(failMode) && !flushCacheOnDeallocate) { -- Assert.assertEquals( -- "flushCacheOnDeallocate is disabled, thus " + failMode + " should cause 'prepared statement \"...\" does not exist'" -- + " error message is " + e.getMessage(), -- PSQLState.INVALID_SQL_STATEMENT_NAME.getState(), e.getSQLState()); -+ assertEquals(PSQLState.INVALID_SQL_STATEMENT_NAME.getState(), e.getSQLState(), "flushCacheOnDeallocate is disabled, thus " + failMode + " should cause 'prepared statement \"...\" does not exist'" -+ + " error message is " + e.getMessage()); - } else if (failMode == FailMode.ALTER) { -- Assert.assertEquals( -- "AutoSave==NEVER, autocommit=NO, thus ALTER TABLE causes SELECT * to fail with " -- + "'cached plan must not change result type', " -- + " error message is " + e.getMessage(), -- PSQLState.NOT_IMPLEMENTED.getState(), e.getSQLState()); -+ assertEquals(PSQLState.NOT_IMPLEMENTED.getState(), e.getSQLState(), "AutoSave==NEVER, autocommit=NO, thus ALTER TABLE causes SELECT * to fail with " -+ + "'cached plan must not change result type', " -+ + " error message is " + e.getMessage()); - } else { - throw e; - } -@@ -357,10 +349,8 @@ public class AutoRollbackTest extends BaseTest4 { - || failMode == FailMode.ALTER) { - // The above statement failed with "prepared statement does not exist", thus subsequent one should fail with - // transaction aborted. -- Assert.assertEquals( -- "AutoSave==NEVER, thus statements should fail with 'current transaction is aborted...', " -- + " error message is " + e.getMessage(), -- PSQLState.IN_FAILED_SQL_TRANSACTION.getState(), e.getSQLState()); -+ assertEquals(PSQLState.IN_FAILED_SQL_TRANSACTION.getState(), e.getSQLState(), "AutoSave==NEVER, thus statements should fail with 'current transaction is aborted...', " -+ + " error message is " + e.getMessage()); - } - } else { - throw e; -@@ -373,22 +363,21 @@ public class AutoRollbackTest extends BaseTest4 { - // in autocommit everything should just work - } else if (TRANS_KILLERS.contains(failMode)) { - if (autoSave != AutoSave.ALWAYS) { -- Assert.fail( -- "autosave= " + autoSave + " != ALWAYS, thus the transaction should be killed"); -+ fail("autosave= " + autoSave + " != ALWAYS, thus the transaction should be killed"); - } - } else if (DEALLOCATES.contains(failMode)) { - if (autoSave == AutoSave.NEVER && !flushCacheOnDeallocate - && con.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE) { -- Assert.fail("flushCacheOnDeallocate == false, thus DEALLOCATE ALL should kill the transaction"); -+ fail("flushCacheOnDeallocate == false, thus DEALLOCATE ALL should kill the transaction"); - } - } else if (failMode == FailMode.ALTER) { - if (autoSave == AutoSave.NEVER - && con.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE - && cols == ReturnColumns.STAR) { -- Assert.fail("autosave=NEVER, thus the transaction should be killed"); -+ fail("autosave=NEVER, thus the transaction should be killed"); - } - } else { -- Assert.fail("It is not specified why the test should pass, thus marking a failure"); -+ fail("It is not specified why the test should pass, thus marking a failure"); - } - } - -@@ -396,7 +385,7 @@ public class AutoRollbackTest extends BaseTest4 { - Statement st = con.createStatement(); - ResultSet rs = st.executeQuery("select count(*) from " + tableName); - rs.next(); -- Assert.assertEquals("Table " + tableName, nrows, rs.getInt(1)); -+ assertEquals(nrows, rs.getInt(1), "Table " + tableName); - } - - private void doCommit() throws SQLException { -diff --git a/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java b/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java -index e690e04..5d38b0a 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java -+++ b/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java -@@ -5,7 +5,8 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.PGProperty; -@@ -16,9 +17,8 @@ import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - - // import org.checkerframework.checker.nullness.qual.Nullable; --import org.junit.After; --import org.junit.Assume; --import org.junit.Before; -+import org.junit.jupiter.api.AfterEach; -+import org.junit.jupiter.api.BeforeEach; - - import java.sql.Connection; - import java.sql.SQLException; -@@ -85,8 +85,40 @@ public class BaseTest4 { - this.reWriteBatchedInserts = reWriteBatchedInserts; - } - -- @Before -- public void setUp() throws Exception { -+ /** -+ * Ensures {@link #setUp()} is called for each subclass. -+ * Note fore test implementation: override {@code setUp()} instead. -+ * JUnit 5 requires all overridden methods to be annotated with {@code @BeforeEach} which -+ * is hard to maintain. If the annotation is missing, then JUnit won't consider the method -+ * for setup. -+ * @throws Exception if setup fails -+ */ -+ @BeforeEach -+ final void beforeEach() throws Exception { -+ setUp(); -+ } -+ -+ /** -+ * Ensures {@link #tearDown()} is called for each subclass. -+ * Note fore test implementation: override {@code tearDown()} instead. -+ * JUnit 5 requires all overridden methods to be annotated with {@code @AfterEach} which -+ * is hard to maintain. If the annotation is missing, then JUnit won't consider the method -+ * for tear down. -+ * @throws Exception if setup fails -+ */ -+ @AfterEach -+ final void afterEach() throws Exception { -+ tearDown(); -+ } -+ -+ /** -+ * Prepares the test environment. -+ * Note: it might be worth moving "create table" statements to {@code @BeforeAll} methods, -+ * so the test creates the table only once, not once for every test method. -+ * Dot not add {@code @BeforeEach} annotation when overriding the method. -+ * @throws Exception if setup fails -+ */ -+ protected void setUp() throws Exception { - Properties props = new Properties(); - updateProperties(props); - con = TestUtil.openDB(props); -@@ -94,56 +126,62 @@ public class BaseTest4 { - preferQueryMode = pg == null ? PreferQueryMode.EXTENDED : pg.getPreferQueryMode(); - } - -- @After -- public void tearDown() throws SQLException { -+ /** -+ * Cleans up the test environment. -+ * Dot not add {@code @AfterEach} annotation when overriding the method. -+ * @throws SQLException if teardown fails -+ */ -+ protected void tearDown() throws SQLException { - TestUtil.closeDB(con); - } - - public static void assumeCallableStatementsSupported(Connection con) throws SQLException { - PreferQueryMode preferQueryMode = con.unwrap(PGConnection.class).getPreferQueryMode(); -- Assume.assumeTrue("callable statements are not fully supported in simple protocol execution mode", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "callable statements are not fully supported in simple protocol execution mode"); - } - - public void assumeCallableStatementsSupported() { -- Assume.assumeTrue("callable statements are not fully supported in simple protocol execution mode", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "callable statements are not fully supported in simple protocol execution mode"); - } - - public void assumeBinaryModeRegular() { -- Assume.assumeTrue(binaryMode == BinaryMode.REGULAR); -+ assumeTrue(binaryMode == BinaryMode.REGULAR); - } - - public void assumeBinaryModeForce() { -- Assume.assumeTrue(binaryMode == BinaryMode.FORCE); -- Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(binaryMode == BinaryMode.FORCE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); - } - - public void assumeNotSimpleQueryMode() { -- Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); - } - - /** - * Shorthand for {@code Assume.assumeTrue(TestUtil.haveMinimumServerVersion(conn, version)}. - */ - public void assumeMinimumServerVersion(String message, Version version) throws SQLException { -- Assume.assumeTrue(message, TestUtil.haveMinimumServerVersion(con, version)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, version), message); - } - - /** - * Shorthand for {@code Assume.assumeTrue(TestUtil.haveMinimumServerVersion(conn, version)}. - */ - public void assumeMinimumServerVersion(Version version) throws SQLException { -- Assume.assumeTrue(TestUtil.haveMinimumServerVersion(con, version)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, version)); - } - - protected void assertBinaryForReceive(int oid, boolean expected, Supplier message) throws SQLException { -- assertEquals(message.get() + ", useBinaryForReceive(oid=" + oid + ")", expected, -- con.unwrap(BaseConnection.class).getQueryExecutor().useBinaryForReceive(oid)); -+ assertEquals( -+ expected, -+ con.unwrap(BaseConnection.class).getQueryExecutor().useBinaryForReceive(oid), -+ () -> message.get() + ", useBinaryForReceive(oid=" + oid + ")"); - } - - protected void assertBinaryForSend(int oid, boolean expected, Supplier message) throws SQLException { -- assertEquals(message.get() + ", useBinaryForSend(oid=" + oid + ")", expected, -- con.unwrap(BaseConnection.class).getQueryExecutor().useBinaryForSend(oid)); -+ assertEquals( -+ expected, -+ con.unwrap(BaseConnection.class).getQueryExecutor().useBinaryForSend(oid), -+ () -> message.get() + ", useBinaryForSend(oid=" + oid + ")"); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java b/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java -index 41f6a14..7bd65ac 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java -@@ -5,14 +5,20 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+ - import org.postgresql.PGProperty; - import org.postgresql.PGStatement; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.BatchUpdateException; - import java.sql.DatabaseMetaData; -@@ -27,15 +33,14 @@ import java.util.Arrays; - import java.util.Collection; - import java.util.Properties; - --/* -- * TODO tests that can be added to this test case - SQLExceptions chained to a BatchUpdateException -- * - test PreparedStatement as thoroughly as Statement -- */ -- --/* -+/** - * Test case for Statement.batchExecute() -+ * TODO tests that can be added to this test case -+ * - SQLExceptions chained to a BatchUpdateException -+ * - test PreparedStatement as thoroughly as Statement - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, insertRewrite = {1}") -+@MethodSource("data") - public class BatchExecuteTest extends BaseTest4 { - - private boolean insertRewrite; -@@ -45,7 +50,6 @@ public class BatchExecuteTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}, insertRewrite = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -99,7 +103,7 @@ public class BatchExecuteTest extends BaseTest4 { - @Test - public void testSupportsBatchUpdates() throws Exception { - DatabaseMetaData dbmd = con.getMetaData(); -- Assert.assertTrue("Expected that Batch Updates are supported", dbmd.supportsBatchUpdates()); -+ assertTrue(dbmd.supportsBatchUpdates(), "Expected that Batch Updates are supported"); - } - - @Test -@@ -115,12 +119,12 @@ public class BatchExecuteTest extends BaseTest4 { - Statement getCol1 = con.createStatement(); - try { - ResultSet rs = getCol1.executeQuery("SELECT col1 FROM testbatch WHERE pk = 1"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - int actual = rs.getInt("col1"); - -- Assert.assertEquals(expected, actual); -- Assert.assertFalse(rs.next()); -+ assertEquals(expected, actual); -+ assertFalse(rs.next()); - - rs.close(); - } finally { -@@ -133,12 +137,12 @@ public class BatchExecuteTest extends BaseTest4 { - Statement stmt = con.createStatement(); - try { - int[] updateCount = stmt.executeBatch(); -- Assert.assertEquals(0, updateCount.length); -+ assertEquals(0, updateCount.length); - - stmt.addBatch("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1"); - stmt.clearBatch(); - updateCount = stmt.executeBatch(); -- Assert.assertEquals(0, updateCount.length); -+ assertEquals(0, updateCount.length); - stmt.close(); - } finally { - TestUtil.closeQuietly(stmt); -@@ -150,7 +154,7 @@ public class BatchExecuteTest extends BaseTest4 { - PreparedStatement ps = con.prepareStatement("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1"); - try { - int[] updateCount = ps.executeBatch(); -- Assert.assertEquals("Empty batch should update empty result", 0, updateCount.length); -+ assertEquals(0, updateCount.length, "Empty batch should update empty result"); - } finally { - TestUtil.closeQuietly(ps); - } -@@ -199,7 +203,7 @@ public class BatchExecuteTest extends BaseTest4 { - ps.addBatch(); - ps.clearBatch(); - int[] updateCount = ps.executeBatch(); -- Assert.assertEquals("Empty batch should update empty result", 0, updateCount.length); -+ assertEquals(0, updateCount.length, "Empty batch should update empty result"); - } finally { - TestUtil.closeQuietly(ps); - } -@@ -226,15 +230,12 @@ public class BatchExecuteTest extends BaseTest4 { - // There's no reason to Assert.fail - int[] updateCounts = stmt.executeBatch(); - -- Assert.assertTrue("First update should succeed, thus updateCount should be 1 or SUCCESS_NO_INFO" -- + ", actual value: " + updateCounts[0], -- updateCounts[0] == 1 || updateCounts[0] == Statement.SUCCESS_NO_INFO); -- Assert.assertTrue("For SELECT, number of modified rows should be either 0 or SUCCESS_NO_INFO" -- + ", actual value: " + updateCounts[1], -- updateCounts[1] == 0 || updateCounts[1] == Statement.SUCCESS_NO_INFO); -- Assert.assertTrue("Second update should succeed, thus updateCount should be 1 or SUCCESS_NO_INFO" -- + ", actual value: " + updateCounts[2], -- updateCounts[2] == 1 || updateCounts[2] == Statement.SUCCESS_NO_INFO); -+ assertTrue(updateCounts[0] == 1 || updateCounts[0] == Statement.SUCCESS_NO_INFO, "First update should succeed, thus updateCount should be 1 or SUCCESS_NO_INFO" -+ + ", actual value: " + updateCounts[0]); -+ assertTrue(updateCounts[1] == 0 || updateCounts[1] == Statement.SUCCESS_NO_INFO, "For SELECT, number of modified rows should be either 0 or SUCCESS_NO_INFO" -+ + ", actual value: " + updateCounts[1]); -+ assertTrue(updateCounts[2] == 1 || updateCounts[2] == Statement.SUCCESS_NO_INFO, "Second update should succeed, thus updateCount should be 1 or SUCCESS_NO_INFO" -+ + ", actual value: " + updateCounts[2]); - } finally { - TestUtil.closeQuietly(stmt); - } -@@ -258,7 +259,7 @@ public class BatchExecuteTest extends BaseTest4 { - int[] updateCounts; - try { - updateCounts = stmt.executeBatch(); -- Assert.fail("0/0 should throw BatchUpdateException"); -+ fail("0/0 should throw BatchUpdateException"); - } catch (BatchUpdateException be) { - updateCounts = be.getUpdateCounts(); - } -@@ -271,13 +272,10 @@ public class BatchExecuteTest extends BaseTest4 { - boolean firstOk = updateCounts[0] == 1 || updateCounts[0] == Statement.SUCCESS_NO_INFO; - boolean lastOk = updateCounts[2] == 1 || updateCounts[2] == Statement.SUCCESS_NO_INFO; - -- Assert.assertEquals("testbatch.col1 should account +1 and +2 for the relevant successful rows: " -- + Arrays.toString(updateCounts), -- oldValue + (firstOk ? 1 : 0) + (lastOk ? 2 : 0), newValue); -+ assertEquals(oldValue + (firstOk ? 1 : 0) + (lastOk ? 2 : 0), newValue, "testbatch.col1 should account +1 and +2 for the relevant successful rows: " -+ + Arrays.toString(updateCounts)); - -- Assert.assertEquals("SELECT 0/0 should be marked as Statement.EXECUTE_FAILED", -- Statement.EXECUTE_FAILED, -- updateCounts[1]); -+ assertEquals(Statement.EXECUTE_FAILED, updateCounts[1], "SELECT 0/0 should be marked as Statement.EXECUTE_FAILED"); - - } finally { - TestUtil.closeQuietly(stmt); -@@ -305,8 +303,7 @@ public class BatchExecuteTest extends BaseTest4 { - - try { - pstmt.addBatch("UPDATE testbatch SET col1 = 3"); -- Assert.fail( -- "Should have thrown an exception about using the string addBatch method on a prepared statement."); -+ fail("Should have thrown an exception about using the string addBatch method on a prepared statement."); - } catch (SQLException sqle) { - } - -@@ -371,9 +368,9 @@ public class BatchExecuteTest extends BaseTest4 { - assertCol1HasValue(0); - - int[] updateCounts = stmt.executeBatch(); -- Assert.assertEquals(2, updateCounts.length); -- Assert.assertEquals(1, updateCounts[0]); -- Assert.assertEquals(1, updateCounts[1]); -+ assertEquals(2, updateCounts.length); -+ assertEquals(1, updateCounts[0]); -+ assertEquals(1, updateCounts[1]); - - assertCol1HasValue(12); - con.commit(); -@@ -391,7 +388,7 @@ public class BatchExecuteTest extends BaseTest4 { - stmt.executeBatch(); - // Execute an empty batch to clear warnings. - stmt.executeBatch(); -- Assert.assertNull(stmt.getWarnings()); -+ assertNull(stmt.getWarnings()); - TestUtil.closeQuietly(stmt); - } - -@@ -410,11 +407,11 @@ public class BatchExecuteTest extends BaseTest4 { - pstmt.close(); - - ResultSet rs = stmt.executeQuery("SELECT d FROM batchescape"); -- Assert.assertTrue(rs.next()); -- Assert.assertEquals("2007-11-20", rs.getString(1)); -- Assert.assertTrue(rs.next()); -- Assert.assertEquals("2007-11-20", rs.getString(1)); -- Assert.assertTrue(!rs.next()); -+ assertTrue(rs.next()); -+ assertEquals("2007-11-20", rs.getString(1)); -+ assertTrue(rs.next()); -+ assertEquals("2007-11-20", rs.getString(1)); -+ assertTrue(!rs.next()); - TestUtil.closeQuietly(stmt); - } - -@@ -435,15 +432,15 @@ public class BatchExecuteTest extends BaseTest4 { - pstmt.setString(1, "b"); - pstmt.addBatch(); - pstmt.executeBatch(); -- Assert.fail("Should have thrown an exception."); -+ fail("Should have thrown an exception."); - } catch (SQLException sqle) { - con.rollback(); - } - pstmt.close(); - - ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM batchstring"); -- Assert.assertTrue(rs.next()); -- Assert.assertEquals(0, rs.getInt(1)); -+ assertTrue(rs.next()); -+ assertEquals(0, rs.getInt(1)); - TestUtil.closeQuietly(stmt); - } - -@@ -461,11 +458,11 @@ public class BatchExecuteTest extends BaseTest4 { - st.addBatch("CREATE TEMPORARY TABLE waffles(sauce text)"); - st.addBatch("INSERT INTO waffles(sauce) VALUES ('cream'), ('strawberry jam')"); - int[] batchResult = st.executeBatch(); -- Assert.assertEquals(1, batchResult[0]); -- Assert.assertEquals(1, batchResult[1]); -- Assert.assertEquals(1, batchResult[2]); -- Assert.assertEquals(0, batchResult[3]); -- Assert.assertEquals(2, batchResult[4]); -+ assertEquals(1, batchResult[0]); -+ assertEquals(1, batchResult[1]); -+ assertEquals(1, batchResult[2]); -+ assertEquals(0, batchResult[3]); -+ assertEquals(2, batchResult[4]); - } catch (SQLException ex) { - ex.getNextException().printStackTrace(); - throw ex; -@@ -549,9 +546,9 @@ public class BatchExecuteTest extends BaseTest4 { - ResultSet rs = st.getGeneratedKeys(); - for (int i = 1; i <= testData.length; i++) { - rs.next(); -- Assert.assertEquals(i, rs.getInt(1)); -+ assertEquals(i, rs.getInt(1)); - } -- Assert.assertTrue(!rs.next()); -+ assertTrue(!rs.next()); - } catch (SQLException ex) { - ex.getNextException().printStackTrace(); - throw ex; -@@ -1188,7 +1185,7 @@ Server SQLState: 25001) - int[] batchResult; - try { - batchResult = batchSt.executeBatch(); -- Assert.fail("Expecting BatchUpdateException as key-2 is duplicated in batchUpdCnt.id. " -+ fail("Expecting BatchUpdateException as key-2 is duplicated in batchUpdCnt.id. " - + " executeBatch returned " + Arrays.toString(batchResult)); - } catch (BatchUpdateException ex) { - batchResult = ex.getUpdateCounts(); -@@ -1199,23 +1196,20 @@ Server SQLState: 25001) - int newCount = getBatchUpdCount(); - if (newCount == 2) { - // key-1 did succeed -- Assert.assertTrue("batchResult[0] should be 1 or SUCCESS_NO_INFO since 'key-1' was inserted," -- + " actual result is " + Arrays.toString(batchResult), -- batchResult[0] == 1 || batchResult[0] == Statement.SUCCESS_NO_INFO); -+ assertTrue(batchResult[0] == 1 || batchResult[0] == Statement.SUCCESS_NO_INFO, "batchResult[0] should be 1 or SUCCESS_NO_INFO since 'key-1' was inserted," -+ + " actual result is " + Arrays.toString(batchResult)); - } else { -- Assert.assertTrue("batchResult[0] should be 0 or EXECUTE_FAILED since 'key-1' was NOT inserted," -- + " actual result is " + Arrays.toString(batchResult), -- batchResult[0] == 0 || batchResult[0] == Statement.EXECUTE_FAILED); -+ assertTrue(batchResult[0] == 0 || batchResult[0] == Statement.EXECUTE_FAILED, "batchResult[0] should be 0 or EXECUTE_FAILED since 'key-1' was NOT inserted," -+ + " actual result is " + Arrays.toString(batchResult)); - } - -- Assert.assertEquals("'key-2' insertion should have Assert.failed", -- Statement.EXECUTE_FAILED, batchResult[1]); -+ assertEquals(Statement.EXECUTE_FAILED, batchResult[1], "'key-2' insertion should have Assert.failed"); - } - - private int getBatchUpdCount() throws SQLException { - PreparedStatement ps = con.prepareStatement("select count(*) from batchUpdCnt"); - ResultSet rs = ps.executeQuery(); -- Assert.assertTrue("count(*) must return 1 row", rs.next()); -+ assertTrue(rs.next(), "count(*) must return 1 row"); - return rs.getInt(1); - } - -@@ -1240,13 +1234,13 @@ Server SQLState: 25001) - pstmt.addBatch();//statement two - int[] outcome = pstmt.executeBatch(); - -- Assert.assertNotNull(outcome); -- Assert.assertEquals(2, outcome.length); -+ assertNotNull(outcome); -+ assertEquals(2, outcome.length); - int rowsInserted = insertRewrite ? Statement.SUCCESS_NO_INFO : 1; -- Assert.assertEquals(rowsInserted, outcome[0]); -- Assert.assertEquals(rowsInserted, outcome[1]); -+ assertEquals(rowsInserted, outcome[0]); -+ assertEquals(rowsInserted, outcome[1]); - } catch (SQLException sqle) { -- Assert.fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); -+ fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); - } finally { - TestUtil.closeQuietly(pstmt); - } -@@ -1269,11 +1263,11 @@ Server SQLState: 25001) - pstmt.setInt(4, 2); - pstmt.addBatch();//statement one - int[] outcome = pstmt.executeBatch(); -- Assert.assertNotNull(outcome); -- Assert.assertEquals(1, outcome.length); -- Assert.assertEquals(2, outcome[0]); -+ assertNotNull(outcome); -+ assertEquals(1, outcome.length); -+ assertEquals(2, outcome[0]); - } catch (SQLException sqle) { -- Assert.fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); -+ fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); - } finally { - TestUtil.closeQuietly(pstmt); - } -@@ -1302,12 +1296,9 @@ Server SQLState: 25001) - pstmt.addBatch(); //statement two - int[] outcome = pstmt.executeBatch(); - int rowsInserted = insertRewrite ? Statement.SUCCESS_NO_INFO : 2; -- Assert.assertEquals( -- "Inserting two multi-valued statements with two rows each. Expecting {2, 2} rows inserted (or SUCCESS_NO_INFO)", -- Arrays.toString(new int[]{rowsInserted, rowsInserted}), -- Arrays.toString(outcome)); -+ assertEquals(Arrays.toString(new int[]{rowsInserted, rowsInserted}), Arrays.toString(outcome), "Inserting two multi-valued statements with two rows each. Expecting {2, 2} rows inserted (or SUCCESS_NO_INFO)"); - } catch (SQLException sqle) { -- Assert.fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); -+ fail("Failed to execute two statements added to a batch. Reason:" + sqle.getMessage()); - } finally { - TestUtil.closeQuietly(pstmt); - } -@@ -1332,10 +1323,7 @@ Server SQLState: 25001) - if (hasChanges) { - message += ", original expectation: " + Arrays.toString(expected); - } -- Assert.assertEquals( -- message, -- Arrays.toString(clone), -- Arrays.toString(actual)); -+ assertEquals(Arrays.toString(clone), Arrays.toString(actual), message); - } - - @Test -@@ -1349,9 +1337,7 @@ Server SQLState: 25001) - ps.addBatch(); - } - int[] actual = ps.executeBatch(); -- Assert.assertTrue( -- "More than 1 row is inserted via executeBatch, it should lead to multiple server statements, thus the statements should be server-prepared", -- ((PGStatement) ps).isUseServerPrepare()); -+ assertTrue(((PGStatement) ps).isUseServerPrepare(), "More than 1 row is inserted via executeBatch, it should lead to multiple server statements, thus the statements should be server-prepared"); - assertBatchResult("3 rows inserted via batch", new int[]{1, 1, 1}, actual); - } finally { - TestUtil.closeQuietly(ps); -@@ -1368,15 +1354,13 @@ Server SQLState: 25001) - int[] actual = ps.executeBatch(); - int prepareThreshold = ((PGStatement) ps).getPrepareThreshold(); - if (prepareThreshold == 1) { -- Assert.assertTrue( -- "prepareThreshold=" + prepareThreshold -- + " thus the statement should be server-prepared", -- ((PGStatement) ps).isUseServerPrepare()); -+ assertTrue(((PGStatement) ps).isUseServerPrepare(), -+ () -> "prepareThreshold=" + prepareThreshold -+ + " thus the statement should be server-prepared"); - } else { -- Assert.assertFalse( -- "Just one row inserted via executeBatch, prepareThreshold=" + prepareThreshold -- + " thus the statement should not be server-prepared", -- ((PGStatement) ps).isUseServerPrepare()); -+ assertFalse(((PGStatement) ps).isUseServerPrepare(), -+ () -> "Just one row inserted via executeBatch, prepareThreshold=" + prepareThreshold -+ + " thus the statement should not be server-prepared"); - } - assertBatchResult("1 rows inserted via batch", new int[]{1}, actual); - } finally { -diff --git a/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java b/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java -index 3d25615..a29c339 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java -@@ -5,13 +5,16 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ - import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.BatchUpdateException; - import java.sql.Connection; -@@ -27,7 +30,8 @@ import java.util.List; - import java.util.Properties; - import java.util.Set; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "{index}: batchTest(mode={2}, position={3}, autoCommit={1}, batchType={0}, generateKeys={1}, binary={4}, insertRewrite={5})") -+@MethodSource("data") - public class BatchFailureTest extends BaseTest4 { - private final BatchType batchType; - private final AutoCommit autoCommit; -@@ -123,7 +127,6 @@ public class BatchFailureTest extends BaseTest4 { - this.insertRewrite = insertRewrite; - } - -- @Parameterized.Parameters(name = "{index}: batchTest(mode={2}, position={3}, autoCommit={1}, batchType={0}, generateKeys={1}, binary={4}, insertRewrite={5})") - public static Iterable data() { - Collection ids = new ArrayList<>(); - boolean[] booleans = new boolean[]{true, false}; -@@ -210,15 +213,13 @@ public class BatchFailureTest extends BaseTest4 { - int expectedRows = 1; - try { - batchResult = statement.executeBatch(); -- Assert.assertTrue("Expecting BatchUpdateException due to " + failMode -- + ", executeBatch returned " + Arrays.toString(batchResult), -- failPosition == FailPosition.NONE); -+ assertTrue(failPosition == FailPosition.NONE, "Expecting BatchUpdateException due to " + failMode -+ + ", executeBatch returned " + Arrays.toString(batchResult)); - expectedRows = pos + 1; // +1 since key-2 is already in the DB - } catch (BatchUpdateException ex) { - batchResult = ex.getUpdateCounts(); -- Assert.assertTrue("Should not fail since fail mode should be " + failMode -- + ", executeBatch returned " + Arrays.toString(batchResult), -- failPosition != FailPosition.NONE); -+ assertTrue(failPosition != FailPosition.NONE, "Should not fail since fail mode should be " + failMode -+ + ", executeBatch returned " + Arrays.toString(batchResult)); - - for (int i : batchResult) { - if (i != Statement.EXECUTE_FAILED) { -@@ -226,11 +227,10 @@ public class BatchFailureTest extends BaseTest4 { - } - } - -- Assert.assertTrue("Batch should fail at row " + minBatchResults -+ assertTrue(batchResult.length >= minBatchResults, "Batch should fail at row " + minBatchResults - + ", thus at least " + minBatchResults - + " items should be returned, actual result is " + batchResult.length + " items, " -- + Arrays.toString(batchResult), -- batchResult.length >= minBatchResults); -+ + Arrays.toString(batchResult)); - } finally { - if (batchType == BatchType.PREPARED_WITH_GENERATED) { - ResultSet rs = statement.getGeneratedKeys(); -@@ -246,29 +246,37 @@ public class BatchFailureTest extends BaseTest4 { - } - - int finalCount = getBatchUpdCount(); -- Assert.assertEquals( -- "Number of new rows in batchUpdCnt should match number of non-error batchResult items" -- + Arrays.toString(batchResult), -- expectedRows - 1, finalCount - 1); -+ int[] batchResultForAssertion = batchResult; -+ assertEquals( -+ expectedRows - 1, -+ finalCount - 1, -+ () -> "Number of new rows in batchUpdCnt should match number of non-error batchResult items" -+ + Arrays.toString(batchResultForAssertion)); - - if (batchType != BatchType.PREPARED_WITH_GENERATED) { - return; - } - - if (finalCount > 1) { -- Assert.assertFalse((finalCount - 1) + " rows were inserted, thus expecting generated keys", -- keys.isEmpty()); -+ assertFalse( -+ keys.isEmpty(), -+ () -> (finalCount - 1) + " rows were inserted, thus expecting generated keys"); - } - Set uniqueKeys = new HashSet<>(keys); -- Assert.assertEquals("Generated keys should be unique: " + keys, keys.size(), uniqueKeys.size()); -- Assert.assertEquals("Number of generated keys should match the number of inserted rows" + keys, -- keys.size(), finalCount - 1); -+ assertEquals( -+ keys.size(), -+ uniqueKeys.size(), -+ () -> "Generated keys should be unique: " + keys); -+ assertEquals( -+ keys.size(), -+ finalCount - 1, -+ () -> "Number of generated keys should match the number of inserted rows" + keys); - } - - private int getBatchUpdCount() throws SQLException { - PreparedStatement ps = con.prepareStatement("select count(*) from batchUpdCnt"); - ResultSet rs = ps.executeQuery(); -- Assert.assertTrue("count(*) must return 1 row", rs.next()); -+ assertTrue(rs.next(), "count(*) must return 1 row"); - return rs.getInt(1); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/BatchedInsertReWriteEnabledTest.java b/src/test/java/org/postgresql/test/jdbc2/BatchedInsertReWriteEnabledTest.java -index b804e05..fe0d666 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/BatchedInsertReWriteEnabledTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/BatchedInsertReWriteEnabledTest.java -@@ -5,14 +5,15 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ - import org.postgresql.PGProperty; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.BatchUpdateException; - import java.sql.PreparedStatement; -@@ -23,7 +24,8 @@ import java.util.Arrays; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "{index}: autoCommit={0}, binary={1}") -+@MethodSource("data") - public class BatchedInsertReWriteEnabledTest extends BaseTest4 { - private final AutoCommit autoCommit; - -@@ -33,7 +35,6 @@ public class BatchedInsertReWriteEnabledTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "{index}: autoCommit={0}, binary={1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (AutoCommit autoCommit : AutoCommit.values()) { -@@ -377,10 +378,11 @@ public class BatchedInsertReWriteEnabledTest extends BaseTest4 { - stmt = con.createStatement(); - stmt.addBatch("INSERT INTO testbatch VALUES (100,'a',200);"); - stmt.addBatch("INSERT INTO testbatch VALUES (300,'b',400);"); -- Assert.assertEquals( -+ assertEquals( -+ Arrays.toString(new int[]{1, 1}), -+ Arrays.toString(stmt.executeBatch()), - "Expected outcome not returned by batch execution. The driver" -- + " allowed re-write in combination with plain statements.", -- Arrays.toString(new int[]{1, 1}), Arrays.toString(stmt.executeBatch())); -+ + " allowed re-write in combination with plain statements."); - } finally { - TestUtil.closeQuietly(stmt); - } -@@ -418,18 +420,18 @@ public class BatchedInsertReWriteEnabledTest extends BaseTest4 { - pstmt.addBatch(); - } - if (nBinds * 2 <= 65535 || preferQueryMode == PreferQueryMode.SIMPLE) { -- Assert.assertEquals( -- "Insert with " + nBinds + " binds should be rewritten into multi-value insert" -- + ", so expecting Statement.SUCCESS_NO_INFO == -2", -+ assertEquals( - Arrays.toString(new int[]{Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO}), -- Arrays.toString(pstmt.executeBatch())); -+ Arrays.toString(pstmt.executeBatch()), -+ () -> "Insert with " + nBinds + " binds should be rewritten into multi-value insert" -+ + ", so expecting Statement.SUCCESS_NO_INFO == -2"); - } else { -- Assert.assertEquals( -- "Insert with " + nBinds + " binds can't be rewritten into multi-value insert" -- + " since write format allows 65535 binds maximum" -- + ", so expecting batch to be executed as individual statements", -+ assertEquals( - Arrays.toString(new int[]{1, 1}), -- Arrays.toString(pstmt.executeBatch())); -+ Arrays.toString(pstmt.executeBatch()), -+ () -> "Insert with " + nBinds + " binds can't be rewritten into multi-value insert" -+ + " since write format allows 65535 binds maximum" -+ + ", so expecting batch to be executed as individual statements"); - } - } catch (BatchUpdateException be) { - SQLException e = be; -diff --git a/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java b/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java -index fa4d0e7..fae9ae2 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java -@@ -5,17 +5,20 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.test.TestUtil; - --import org.junit.BeforeClass; --import org.junit.Test; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; - -+import java.math.BigDecimal; - import java.sql.Array; - import java.sql.CallableStatement; - import java.sql.Connection; -@@ -25,13 +28,13 @@ import java.sql.SQLWarning; - import java.sql.Statement; - import java.sql.Types; - --/* -+/** - * CallableStatement tests. - * - * @author Paul Bethe - */ - public class CallableStmtTest extends BaseTest4 { -- @BeforeClass -+ @BeforeAll - public static void beforeClass() throws Exception { - try (Connection con = TestUtil.openDB()) { - assumeCallableStatementsSupported(con); -@@ -125,11 +128,11 @@ public class CallableStmtTest extends BaseTest4 { - assertNotNull(rs); - assertTrue(rs.next()); - assertEquals(42.42, rs.getDouble(1), 0.00001); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - rs.close(); - - assertEquals(-1, call.getUpdateCount()); -- assertTrue(!call.getMoreResults()); -+ assertFalse(call.getMoreResults()); - call.close(); - } - -@@ -175,7 +178,7 @@ public class CallableStmtTest extends BaseTest4 { - call.setBigDecimal(2, new java.math.BigDecimal(4)); - call.registerOutParameter(1, Types.NUMERIC); - call.execute(); -- assertEquals(new java.math.BigDecimal(42), call.getBigDecimal(1)); -+ assertEquals(new BigDecimal(42), call.getBigDecimal(1)); - } - - @Test -@@ -183,7 +186,7 @@ public class CallableStmtTest extends BaseTest4 { - CallableStatement call = con.prepareCall(func + pkgName + "getNumericWithoutArg () }"); - call.registerOutParameter(1, Types.NUMERIC); - call.execute(); -- assertEquals(new java.math.BigDecimal(42), call.getBigDecimal(1)); -+ assertEquals(new BigDecimal(42), call.getBigDecimal(1)); - } - - @Test -@@ -207,7 +210,7 @@ public class CallableStmtTest extends BaseTest4 { - assertEquals(1, rs.getInt(1)); - assertTrue(rs.next()); - assertEquals(2, rs.getInt(1)); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -235,7 +238,7 @@ public class CallableStmtTest extends BaseTest4 { - cs.wasNull(); - fail("expected exception"); - } catch (Exception e) { -- assertTrue(e instanceof SQLException); -+ assertInstanceOf(SQLException.class, e); - } - } - -@@ -248,7 +251,7 @@ public class CallableStmtTest extends BaseTest4 { - cs.getString(1); - fail("expected exception"); - } catch (Exception e) { -- assertTrue(e instanceof SQLException); -+ assertInstanceOf(SQLException.class, e); - } - } - -@@ -260,7 +263,7 @@ public class CallableStmtTest extends BaseTest4 { - cs.getObject(1); - fail("expected exception"); - } catch (Exception e) { -- assertTrue(e instanceof SQLException); -+ assertInstanceOf(SQLException.class, e); - } - } - -@@ -300,7 +303,7 @@ public class CallableStmtTest extends BaseTest4 { - assertEquals(2, rs.getInt(1)); - assertTrue(rs.next()); - assertEquals(3, rs.getInt(1)); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/ClientEncodingTest.java b/src/test/java/org/postgresql/test/jdbc2/ClientEncodingTest.java -index 117b399..b061904 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ClientEncodingTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ClientEncodingTest.java -@@ -5,14 +5,18 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+ - import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.Parameter; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.ResultSet; - import java.sql.SQLException; -@@ -20,10 +24,11 @@ import java.sql.Statement; - import java.util.Arrays; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "allowEncodingChanges={0}") -+@MethodSource("data") - public class ClientEncodingTest extends BaseTest4 { - -- @Parameterized.Parameter(0) -+ @Parameter - public boolean allowEncodingChanges; - - @Override -@@ -32,7 +37,6 @@ public class ClientEncodingTest extends BaseTest4 { - PGProperty.ALLOW_ENCODING_CHANGES.set(props, allowEncodingChanges); - } - -- @Parameterized.Parameters(name = "allowEncodingChanges={0}") - public static Iterable data() { - return Arrays.asList(new Object[][]{ - {true}, -@@ -53,15 +57,14 @@ public class ClientEncodingTest extends BaseTest4 { - try { - setEncoding("sql_ascii"); - if (!allowEncodingChanges) { -- Assert.fail( -- "allowEncodingChanges is false, thus set client_encoding=aql_ascii is expected to fail"); -+ fail("allowEncodingChanges is false, thus set client_encoding=aql_ascii is expected to fail"); - } - } catch (SQLException e) { - if (!allowEncodingChanges && !PSQLState.CONNECTION_FAILURE.getState() - .equals(e.getSQLState())) { - throw e; - } -- Assert.assertTrue("Connection should be closed on client_encoding change", con.isClosed()); -+ assertTrue(con.isClosed(), "Connection should be closed on client_encoding change"); - return; - } - -@@ -72,7 +75,7 @@ public class ClientEncodingTest extends BaseTest4 { - Statement st = con.createStatement(); - ResultSet rs = st.executeQuery("select 'abc' as x"); - rs.next(); -- Assert.assertEquals("abc", rs.getString(1)); -+ assertEquals("abc", rs.getString(1)); - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(st); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/ConcurrentStatementFetch.java b/src/test/java/org/postgresql/test/jdbc2/ConcurrentStatementFetch.java -deleted file mode 100644 -index 53b5b52..0000000 ---- a/src/test/java/org/postgresql/test/jdbc2/ConcurrentStatementFetch.java -+++ /dev/null -@@ -1,81 +0,0 @@ --/* -- * Copyright (c) 2017, PostgreSQL Global Development Group -- * See the LICENSE file in the project root for more information. -- */ -- --package org.postgresql.test.jdbc2; -- --import org.postgresql.core.ServerVersion; --import org.postgresql.test.TestUtil; -- --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -- --import java.sql.PreparedStatement; --import java.sql.ResultSet; --import java.util.ArrayList; --import java.util.Collection; -- --@RunWith(Parameterized.class) --public class ConcurrentStatementFetch extends BaseTest4 { -- -- private final AutoCommit autoCommit; -- private final int fetchSize; -- -- public ConcurrentStatementFetch(AutoCommit autoCommit, int fetchSize, BinaryMode binaryMode) { -- this.autoCommit = autoCommit; -- this.fetchSize = fetchSize; -- setBinaryMode(binaryMode); -- } -- -- @Parameterized.Parameters(name = "{index}: fetch(autoCommit={0}, fetchSize={1}, binaryMode={2})") -- public static Iterable data() { -- Collection ids = new ArrayList<>(); -- for (AutoCommit autoCommit : AutoCommit.values()) { -- for (int fetchSize : new int[]{1, 2, 20}) { -- for (BinaryMode binaryMode : BinaryMode.values()) { -- ids.add(new Object[]{autoCommit, fetchSize, binaryMode}); -- } -- } -- } -- return ids; -- } -- -- @Override -- public void setUp() throws Exception { -- super.setUp(); -- con.setAutoCommit(autoCommit == AutoCommit.YES); -- } -- -- @Test -- public void testFetchTwoStatements() throws Exception { -- // This test definitely fails at 8.2 in autocommit=false, and works with 8.4+ -- Assume.assumeTrue(autoCommit == AutoCommit.YES -- || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)); -- PreparedStatement ps1 = null; -- PreparedStatement ps2 = null; -- try { -- ps1 = con.prepareStatement("select * from generate_series(0, 9)"); -- ps1.setFetchSize(fetchSize); -- ResultSet rs1 = ps1.executeQuery(); -- ps2 = con.prepareStatement("select * from generate_series(10, 19)"); -- ps2.setFetchSize(fetchSize); -- ResultSet rs2 = ps2.executeQuery(); -- -- for (int i = 0; i < 10; i++) { -- Assert.assertTrue(rs1.next()); -- Assert.assertTrue(rs2.next()); -- Assert.assertEquals("Row#" + i + ", resultset 1", i, rs1.getInt(1)); -- Assert.assertEquals("Row#" + i + ", resultset 2", i + 10, rs2.getInt(1)); -- } -- Assert.assertFalse(rs1.next()); -- Assert.assertFalse(rs2.next()); -- } finally { -- TestUtil.closeQuietly(ps1); -- TestUtil.closeQuietly(ps2); -- } -- } --} -diff --git a/src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java b/src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java -index aa37f02..27fa6cc 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java -@@ -5,13 +5,14 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; - import static org.junit.jupiter.api.Assertions.assertTrue; - import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeFalse; - - import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; - -@@ -57,14 +58,17 @@ class ConnectTimeoutTest { - * We treat this as a skipped test, as the test didn't really "succeed" - * in testing the original behaviour, but it didn't fail either. - */ -- Assumptions.assumeFalse(e.getCause() instanceof NoRouteToHostException -- && interval < connectTimeoutMillis, -- "Host fast-failed connection to unreachable address " -- + UNREACHABLE_HOST + " after " + interval + " ms, " -- + " before timeout should have triggered."); -+ assumeFalse( -+ e.getCause() instanceof NoRouteToHostException -+ && interval < connectTimeoutMillis, -+ () -> "Host fast-failed connection to unreachable address " -+ + UNREACHABLE_HOST + " after " + interval + " ms, " -+ + " before timeout should have triggered."); - -- assertTrue(e.getCause() instanceof SocketTimeoutException, -- "Unexpected " + e.toString() + " with cause " + e.getCause()); -+ assertInstanceOf( -+ SocketTimeoutException.class, -+ e.getCause(), -+ () -> "Unexpected " + e + " with cause " + e.getCause()); - // check that it was not a default system timeout, an approximate value is used - assertTrue(Math.abs(interval - connectTimeoutMillis) < maxDeviation); - return; -diff --git a/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java b/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java -index 398035f..2fa7f19 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java -@@ -5,15 +5,16 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.PGConnection; - import org.postgresql.test.TestUtil; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -21,18 +22,19 @@ import java.sql.SQLException; - import java.sql.Statement; - import java.util.ArrayList; - import java.util.Collection; -+import java.util.function.Supplier; - --/* -+/** - * Tests for using non-zero setFetchSize(). - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class CursorFetchTest extends BaseTest4 { - - public CursorFetchTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -80,18 +82,16 @@ public class CursorFetchTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery(); - if (!con.unwrap(PGConnection.class).getAdaptiveFetch()) { -- assertEquals("ResultSet.fetchSize should not change after query execution", -- testSize, -- rs.getFetchSize()); -+ assertEquals(testSize, rs.getFetchSize(), "ResultSet.fetchSize should not change after query execution"); - } - - int count = 0; - while (rs.next()) { -- assertEquals("query value error with fetch size " + testSize, count, rs.getInt(1)); -+ assertEquals(count, rs.getInt(1), () -> "query value error with fetch size " + testSize); - ++count; - } - -- assertEquals("total query size error with fetch size " + testSize, 100, count); -+ assertEquals(100, count, () -> "total query size error with fetch size " + testSize); - } - } - -@@ -110,14 +110,12 @@ public class CursorFetchTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery(); - if (!con.unwrap(PGConnection.class).getAdaptiveFetch()) { -- assertEquals("ResultSet.fetchSize should not change after query execution", -- testSize, -- rs.getFetchSize()); -+ assertEquals(testSize, rs.getFetchSize(), "ResultSet.fetchSize should not change after query execution"); - } - - for (int j = 0; j <= 50; j++) { -- assertTrue("ran out of rows at position " + j + " with fetch size " + testSize, rs.next()); -- assertEquals("query value error with fetch size " + testSize, j, rs.getInt(1)); -+ assertTrue(rs.next(), "ran out of rows at position " + j + " with fetch size " + testSize); -+ assertEquals(j, rs.getInt(1), () -> "query value error with fetch size " + testSize); - } - - int position = 50; -@@ -125,19 +123,15 @@ public class CursorFetchTest extends BaseTest4 { - for (int k = 0; k < j; k++) { - if (j % 2 == 0) { - ++position; -- assertTrue("ran out of rows doing a forward fetch on iteration " + j + "/" + k -- + " at position " + position + " with fetch size " + testSize, rs.next()); -+ assertTrue(rs.next(), "ran out of rows doing a forward fetch on iteration " + j + "/" + k -+ + " at position " + position + " with fetch size " + testSize); - } else { - --position; -- assertTrue( -- "ran out of rows doing a reverse fetch on iteration " + j + "/" + k -- + " at position " + position + " with fetch size " + testSize, -- rs.previous()); -+ assertTrue(rs.previous(), "ran out of rows doing a reverse fetch on iteration " + j + "/" + k -+ + " at position " + position + " with fetch size " + testSize); - } - -- assertEquals( -- "query value error on iteration " + j + "/" + k + " with fetch size " + testSize, -- position, rs.getInt(1)); -+ assertEquals(position, rs.getInt(1), "query value error on iteration " + j + "/" + k + " with fetch size " + testSize); - } - } - } -@@ -157,15 +151,13 @@ public class CursorFetchTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery(); - if (!con.unwrap(PGConnection.class).getAdaptiveFetch()) { -- assertEquals("ResultSet.fetchSize should not change after query execution", -- testSize, -- rs.getFetchSize()); -+ assertEquals(testSize, rs.getFetchSize(), "ResultSet.fetchSize should not change after query execution"); - } - - int position = 50; -- assertTrue("ran out of rows doing an absolute fetch at " + position + " with fetch size " -- + testSize, rs.absolute(position + 1)); -- assertEquals("query value error with fetch size " + testSize, position, rs.getInt(1)); -+ assertTrue(rs.absolute(position + 1), "ran out of rows doing an absolute fetch at " + position + " with fetch size " -+ + testSize); -+ assertEquals(position, rs.getInt(1), () -> "query value error with fetch size " + testSize); - - for (int j = 1; j < 100; j++) { - if (j % 2 == 0) { -@@ -174,9 +166,9 @@ public class CursorFetchTest extends BaseTest4 { - position -= j; - } - -- assertTrue("ran out of rows doing an absolute fetch at " + position + " on iteration " + j -- + " with fetchsize" + testSize, rs.absolute(position + 1)); -- assertEquals("query value error with fetch size " + testSize, position, rs.getInt(1)); -+ assertTrue(rs.absolute(position + 1), "ran out of rows doing an absolute fetch at " + position + " on iteration " + j -+ + " with fetchsize" + testSize); -+ assertEquals(position, rs.getInt(1), () -> "query value error with fetch size " + testSize); - } - } - } -@@ -304,27 +296,27 @@ public class CursorFetchTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery("select * from test_fetch order by value"); - - msg = "before-first row positioning error with fetchsize=" + size; -- assertTrue(msg, rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ assertTrue(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - msg = "row 1 positioning error with fetchsize=" + size; -- assertTrue(msg, rs.next()); -+ assertTrue(rs.next(), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, rs.isFirst()); -- assertTrue(msg, rs.isLast()); -- assertEquals(msg, 0, rs.getInt(1)); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertTrue(rs.isFirst(), msg); -+ assertTrue(rs.isLast(), msg); -+ assertEquals(0, rs.getInt(1), msg); - - msg = "after-last row positioning error with fetchsize=" + size; -- assertTrue(msg, !rs.next()); -+ assertFalse(rs.next(), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertTrue(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - rs.close(); - stmt.close(); -@@ -344,38 +336,38 @@ public class CursorFetchTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery("select * from test_fetch order by value"); - msg = "before-first row positioning error with fetchsize=" + size; -- assertTrue(msg, rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ assertTrue(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - for (int j = 0; j < 100; j++) { - msg = "row " + j + " positioning error with fetchsize=" + size; -- assertTrue(msg, rs.next()); -- assertEquals(msg, j, rs.getInt(1)); -+ assertTrue(rs.next(), msg); -+ assertEquals(j, rs.getInt(1), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); - if (j == 0) { -- assertTrue(msg, rs.isFirst()); -+ assertTrue(rs.isFirst(), msg); - } else { -- assertTrue(msg, !rs.isFirst()); -+ assertFalse(rs.isFirst(), msg); - } - - if (j == 99) { -- assertTrue(msg, rs.isLast()); -+ assertTrue(rs.isLast(), msg); - } else { -- assertTrue(msg, !rs.isLast()); -+ assertFalse(rs.isLast(), msg); - } - } - - msg = "after-last row positioning error with fetchsize=" + size; -- assertTrue(msg, !rs.next()); -+ assertFalse(rs.next(), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertTrue(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - rs.close(); - stmt.close(); -@@ -400,7 +392,7 @@ public class CursorFetchTest extends BaseTest4 { - "insert into test_fetch(value) values(100); select * from test_fetch order by value"); - stmt.setFetchSize(10); - -- assertTrue(!stmt.execute()); // INSERT -+ assertFalse(stmt.execute()); // INSERT - assertTrue(stmt.getMoreResults()); // SELECT - ResultSet rs = stmt.getResultSet(); - int count = 0; -@@ -461,31 +453,31 @@ public class CursorFetchTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery("select * from test_fetch order by value"); - msg = "before-first row positioning error with fetchsize=" + size; -- assertTrue(msg, rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -+ assertTrue(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); - - for (int j = 0; j < rowCount; j++) { - msg = "row " + j + " positioning error with fetchsize=" + size; -- assertTrue(msg, rs.next()); -- assertEquals(msg, j, rs.getInt(1)); -+ assertTrue(rs.next(), msg); -+ assertEquals(j, rs.getInt(1), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); - if (j == 0) { -- assertTrue(msg, rs.isFirst()); -+ assertTrue(rs.isFirst(), msg); - } else { -- assertTrue(msg, !rs.isFirst()); -+ assertFalse(rs.isFirst(), msg); - } - } - - msg = "after-last row positioning error with fetchsize=" + size; -- assertTrue(msg, !rs.next()); -+ assertFalse(rs.next(), msg); - -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertTrue(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - rs.close(); - stmt.close(); -@@ -501,17 +493,17 @@ public class CursorFetchTest extends BaseTest4 { - stmt.setFetchSize(size); - - ResultSet rs = stmt.executeQuery("select * from test_fetch order by value"); -- String msg = "no row (empty resultset) positioning error with fetchsize=" + size; -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -- -- assertTrue(msg, !rs.next()); -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ Supplier msg = () -> "no row (empty resultset) positioning error with fetchsize=" + size; -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); -+ -+ assertFalse(rs.next(), msg); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - rs.close(); - stmt.close(); -@@ -528,23 +520,23 @@ public class CursorFetchTest extends BaseTest4 { - stmt.setFetchSize(size); - - ResultSet rs = stmt.executeQuery("select * from test_fetch order by value"); -- String msg = "no row (empty resultset) positioning error with fetchsize=" + size; -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -- -- assertTrue(msg, !rs.first()); -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -- -- assertTrue(msg, !rs.next()); -- assertTrue(msg, !rs.isBeforeFirst()); -- assertTrue(msg, !rs.isAfterLast()); -- assertTrue(msg, !rs.isFirst()); -- assertTrue(msg, !rs.isLast()); -+ Supplier msg = () -> "no row (empty resultset) positioning error with fetchsize=" + size; -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); -+ -+ assertFalse(rs.first(), msg); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); -+ -+ assertFalse(rs.next(), msg); -+ assertFalse(rs.isBeforeFirst(), msg); -+ assertFalse(rs.isAfterLast(), msg); -+ assertFalse(rs.isFirst(), msg); -+ assertFalse(rs.isLast(), msg); - - rs.close(); - stmt.close(); -diff --git a/src/test/java/org/postgresql/test/jdbc2/CustomTypeWithBinaryTransferTest.java b/src/test/java/org/postgresql/test/jdbc2/CustomTypeWithBinaryTransferTest.java -index 1fd3d80..9292a63 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/CustomTypeWithBinaryTransferTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/CustomTypeWithBinaryTransferTest.java -@@ -5,9 +5,9 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.PGConnection; - import org.postgresql.core.BaseConnection; -@@ -19,11 +19,11 @@ import org.postgresql.util.PGBinaryObject; - import org.postgresql.util.PGobject; - - // import org.checkerframework.checker.nullness.qual.Nullable; --import org.junit.AfterClass; --import org.junit.BeforeClass; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.AfterAll; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Connection; - import java.sql.PreparedStatement; -@@ -36,7 +36,8 @@ import java.util.Collection; - /** - * TestCase to test handling of binary types for custom objects. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - // define an oid of a binary type for testing, POINT is used here as it already exists in the - // database and requires no complex own type definition -@@ -46,7 +47,6 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -60,7 +60,7 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - * - * @throws SQLException if a database error occurs - */ -- @BeforeClass -+ @BeforeAll - public static void createTestTable() throws SQLException { - try (Connection con = TestUtil.openDB()) { - TestUtil.createTable(con, "test_binary_pgobject", "id integer,name text,geom point"); -@@ -72,7 +72,7 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - * - * @throws SQLException if a database error occurs - */ -- @AfterClass -+ @AfterAll - public static void dropTestTable() throws SQLException { - try (Connection con = TestUtil.openDB()) { - TestUtil.dropTable(con, "test_binary_pgobject"); -@@ -108,8 +108,7 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - PGConnection pgconn = con.unwrap(PGConnection.class); - - // make sure the test type implements PGBinaryObject -- assertTrue("test type should implement PGBinaryObject", -- PGBinaryObject.class.isAssignableFrom(TestCustomType.class)); -+ assertTrue(PGBinaryObject.class.isAssignableFrom(TestCustomType.class), "test type should implement PGBinaryObject"); - - // now define a custom type, which will add it to the binary sent/received OIDs (if the type - // implements PGBinaryObject) -@@ -129,27 +128,20 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - try (PreparedStatement pst = con.prepareStatement("SELECT geom FROM test_binary_pgobject WHERE id=?")) { - pst.setInt(1, 1); - try (ResultSet rs = pst.executeQuery()) { -- assertTrue("rs.next()", rs.next()); -+ assertTrue(rs.next(), "rs.next()"); - Object o = rs.getObject(1); - co = (TestCustomType) o; - // now binary transfer should be working - if (preferQueryMode == PreferQueryMode.SIMPLE) { -- assertEquals( -- "reading via prepared statement: TestCustomType.wasReadBinary() should use text encoding since preferQueryMode=SIMPLE", -- "text", -- co.wasReadBinary() ? "binary" : "text"); -+ assertEquals("text", co.wasReadBinary() ? "binary" : "text", "reading via prepared statement: TestCustomType.wasReadBinary() should use text encoding since preferQueryMode=SIMPLE"); - } else { -- assertEquals( -- "reading via prepared statement: TestCustomType.wasReadBinary() should use match binary mode requested by the test", -- binaryMode == BinaryMode.FORCE ? "binary" : "text", -- co.wasReadBinary() ? "binary" : "text"); -+ assertEquals(binaryMode == BinaryMode.FORCE ? "binary" : "text", co.wasReadBinary() ? "binary" : "text", "reading via prepared statement: TestCustomType.wasReadBinary() should use match binary mode requested by the test"); - } - } - } - - // ensure flag is still unset -- assertFalse("wasWrittenBinary should be false since we have not written the object yet", -- co.wasWrittenBinary()); -+ assertFalse(co.wasWrittenBinary(), "wasWrittenBinary should be false since we have not written the object yet"); - // now try to write it - try (PreparedStatement pst = - con.prepareStatement("INSERT INTO test_binary_pgobject(id,geom) VALUES(?,?)")) { -@@ -159,14 +151,14 @@ public class CustomTypeWithBinaryTransferTest extends BaseTest4 { - // make sure transfer was binary - if (preferQueryMode == PreferQueryMode.SIMPLE) { - assertEquals( -- "writing via prepared statement: TestCustomType.wasWrittenBinary() should use text encoding since preferQueryMode=SIMPLE", - "text", -- co.wasWrittenBinary() ? "binary" : "text"); -+ co.wasWrittenBinary() ? "binary" : "text", -+ "writing via prepared statement: TestCustomType.wasWrittenBinary() should use text encoding since preferQueryMode=SIMPLE"); - } else { - assertEquals( -- "writing via prepared statement: TestCustomType.wasWrittenBinary() should use match binary mode requested by the test", - binaryMode == BinaryMode.FORCE ? "binary" : "text", -- co.wasWrittenBinary() ? "binary" : "text"); -+ co.wasWrittenBinary() ? "binary" : "text", -+ "writing via prepared statement: TestCustomType.wasWrittenBinary() should use match binary mode requested by the test"); - } - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java b/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java -index c070936..89c7971 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java -@@ -7,12 +7,12 @@ package org.postgresql.test.jdbc2; - - import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.Encoding; - import org.postgresql.test.TestUtil; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; - -@@ -68,7 +68,7 @@ class DatabaseEncodingTest { - @Test - void encoding() throws Exception { - String databaseEncoding = TestUtil.queryForString(con, "SELECT getdatabaseencoding()"); -- Assumptions.assumeTrue("UTF8".equals(databaseEncoding), "Database encoding must be UTF8"); -+ assumeTrue("UTF8".equals(databaseEncoding), "Database encoding must be UTF8"); - - boolean testHighUnicode = true; - -diff --git a/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java -index 3a22995..4cfdc52 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java -@@ -14,6 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; - import static org.junit.jupiter.api.Assertions.assertNotNull; - import static org.junit.jupiter.api.Assertions.assertNull; - import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; -@@ -21,9 +22,9 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4.BinaryMode; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeEach; --import org.junit.jupiter.params.ParameterizedTest; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; - import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Connection; -@@ -43,13 +44,20 @@ import java.util.List; - import java.util.Properties; - import java.util.Set; - --/* -+/** - * TestCase to test the internal functionality of org.postgresql.jdbc2.DatabaseMetaData -- * - */ -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class DatabaseMetaDataTest { - private Connection con; - -+ private final BinaryMode binaryMode; -+ -+ public DatabaseMetaDataTest(BinaryMode binaryMode) { -+ this.binaryMode = binaryMode; -+ } -+ - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -59,7 +67,7 @@ public class DatabaseMetaDataTest { - } - - @BeforeEach -- void setUp(BinaryMode binaryMode) throws Exception { -+ void setUp() throws Exception { - if (binaryMode == BinaryMode.FORCE) { - final Properties props = new Properties(); - PGProperty.PREPARE_THRESHOLD.set(props, -1); -@@ -192,9 +200,8 @@ public class DatabaseMetaDataTest { - TestUtil.closeDB(con); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void arrayTypeInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void arrayTypeInfo() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "intarraytable", "a"); - assertTrue(rs.next()); -@@ -207,9 +214,8 @@ public class DatabaseMetaDataTest { - TestUtil.closeQuietly(rs); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void arrayInt4DoubleDim(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void arrayInt4DoubleDim() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "intarraytable", "b"); - assertTrue(rs.next()); -@@ -220,9 +226,8 @@ public class DatabaseMetaDataTest { - assertEquals("_int4", rs.getString("TYPE_NAME")); // even int4[][] is represented as _int4 - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void customArrayTypeInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void customArrayTypeInfo() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet res = dbmd.getColumns(null, null, "customtable", null); - assertTrue(res.next()); -@@ -257,9 +262,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void tables_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void tables_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws Exception { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - -@@ -272,9 +276,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void tables(BinaryMode binaryMode) throws Exception { -+ @Test -+ void tables() throws Exception { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - -@@ -313,9 +316,8 @@ public class DatabaseMetaDataTest { - assertEquals(Types.TIMESTAMP, rs.getInt("DATA_TYPE")); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void crossReference_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void crossReference_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "vv", "a int not null, b int not null, constraint vv_pkey primary key ( a, b )"); - -@@ -333,9 +335,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void crossReference(BinaryMode binaryMode) throws Exception { -+ @Test -+ void crossReference() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "vv", "a int not null, b int not null, constraint vv_pkey primary key ( a, b )"); - -@@ -381,9 +382,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeyActions_whenSchemaArgEmpty_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeyActions_whenSchemaArgEmpty_expectNoResults() throws Exception { - try (Connection conn = TestUtil.openDB()) { - TestUtil.createTable(conn, "pkt", "id int primary key"); - TestUtil.createTable(conn, "fkt1", -@@ -406,9 +406,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeyActions(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeyActions() throws Exception { - try (Connection conn = TestUtil.openDB()) { - TestUtil.createTable(conn, "pkt", "id int primary key"); - TestUtil.createTable(conn, "fkt1", -@@ -435,9 +434,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeysToUniqueIndexes_whenCatalogAndSchemaArgsEmpty_expect(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeysToUniqueIndexes_whenCatalogAndSchemaArgsEmpty_expect() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "pkt", - "a int not null, b int not null, CONSTRAINT pkt_pk_a PRIMARY KEY (a), CONSTRAINT pkt_un_b UNIQUE (b)"); -@@ -453,9 +451,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeysToUniqueIndexes(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeysToUniqueIndexes() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "pkt", - "a int not null, b int not null, CONSTRAINT pkt_pk_a PRIMARY KEY (a), CONSTRAINT pkt_un_b UNIQUE (b)"); -@@ -478,9 +475,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void multiColumnForeignKeys_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void multiColumnForeignKeys_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "pkt", - "a int not null, b int not null, CONSTRAINT pkt_pk PRIMARY KEY (a,b)"); -@@ -496,9 +492,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void multiColumnForeignKeys(BinaryMode binaryMode) throws Exception { -+ @Test -+ void multiColumnForeignKeys() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "pkt", - "a int not null, b int not null, CONSTRAINT pkt_pk PRIMARY KEY (a,b)"); -@@ -527,9 +522,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void sameTableForeignKeys_whenSchemaArgEmpty_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void sameTableForeignKeys_whenSchemaArgEmpty_expectNoResults() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - - TestUtil.createTable(con1, "person", -@@ -555,9 +549,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void sameTableForeignKeys(BinaryMode binaryMode) throws Exception { -+ @Test -+ void sameTableForeignKeys() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "person", - "FIRST_NAME character varying(100) NOT NULL," + "LAST_NAME character varying(100) NOT NULL," -@@ -618,9 +611,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeys_whenSchemaArgNull_expectNoResults(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeys_whenSchemaArgNull_expectNoResults() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "people", "id int4 primary key, name text"); - TestUtil.createTable(con1, "policy", "id int4 primary key, name text"); -@@ -647,9 +639,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void foreignKeys(BinaryMode binaryMode) throws Exception { -+ @Test -+ void foreignKeys() throws Exception { - try (Connection con1 = TestUtil.openDB()) { - TestUtil.createTable(con1, "people", "id int4 primary key, name text"); - TestUtil.createTable(con1, "policy", "id int4 primary key, name text"); -@@ -707,9 +698,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void numericPrecision(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void numericPrecision() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - ResultSet rs = dbmd.getColumns(null, "public", "precision_test", "%"); -@@ -718,9 +708,8 @@ public class DatabaseMetaDataTest { - assertFalse(rs.next(), "It should have a single column"); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void columns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void columns() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - String [] metadataColumns = {"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", - "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", -@@ -740,9 +729,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void droppedColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void droppedColumns() throws SQLException { - if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { - return; - } -@@ -790,18 +778,16 @@ public class DatabaseMetaDataTest { - - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void testGetFunctionColumnsBadCatalog(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void testGetFunctionColumnsBadCatalog() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - try (ResultSet rs = dbmd.getColumns("nonsensecatalog", null, "sercoltest", null)) { - assertFalse(rs.next()); - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void serialColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void serialColumns() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - try (ResultSet rs = dbmd.getColumns(null, null, "sercoltest", null)) { - int rownum = 0; -@@ -825,9 +811,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void columnPrivileges(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void columnPrivileges() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); -@@ -864,22 +849,19 @@ public class DatabaseMetaDataTest { - + relationName + " for " + TestUtil.getUser()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void tablePrivileges(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void tablePrivileges() throws SQLException { - relationPrivilegesHelper("metadatatest"); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void viewPrivileges(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void viewPrivileges() throws SQLException { - relationPrivilegesHelper("viewtest"); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void materializedViewPrivileges(BinaryMode binaryMode) throws SQLException { -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_3)); -+ @Test -+ void materializedViewPrivileges() throws SQLException { -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_3)); - TestUtil.createMaterializedView(con, "matviewtest", "SELECT id, quest FROM metadatatest"); - try { - relationPrivilegesHelper("matviewtest"); -@@ -888,9 +870,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void noTablePrivileges(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void noTablePrivileges() throws SQLException { - Statement stmt = con.createStatement(); - stmt.execute("REVOKE ALL ON metadatatest FROM PUBLIC"); - stmt.execute("REVOKE ALL ON metadatatest FROM " + TestUtil.getUser()); -@@ -899,9 +880,8 @@ public class DatabaseMetaDataTest { - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void primaryKeys(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void primaryKeys() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); -@@ -909,9 +889,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void indexInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void indexInfo() throws SQLException { - Statement stmt = con.createStatement(); - stmt.execute("create index idx_id on metadatatest (id)"); - stmt.execute("create index idx_func_single on metadatatest (upper(colour))"); -@@ -969,9 +948,8 @@ public class DatabaseMetaDataTest { - * Order defined at - * https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getIndexInfo-java.lang.String-java.lang.String-java.lang.String-boolean-boolean- - */ -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void indexInfoColumnOrder(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void indexInfoColumnOrder() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - /* -@@ -1012,9 +990,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void indexInfoColumnCase(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void indexInfoColumnCase() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - -@@ -1031,17 +1008,15 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void notNullDomainColumn_whenCatalogAndSchemaAndColumnNameArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void notNullDomainColumn_whenCatalogAndSchemaAndColumnNameArgsEmpty_expectNoResults() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns("", "", "domaintable", ""); - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void notNullDomainColumn(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void notNullDomainColumn() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "domaintable", null); - assertTrue(rs.next()); -@@ -1052,17 +1027,15 @@ public class DatabaseMetaDataTest { - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void domainColumnSize_whenCatalogAndSchemaAndColumnNameArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void domainColumnSize_whenCatalogAndSchemaAndColumnNameArgsEmpty_expectNoResults() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns("", "", "domaintable", ""); - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void domainColumnSize(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void domainColumnSize() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "domaintable", null); - assertTrue(rs.next()); -@@ -1078,9 +1051,8 @@ public class DatabaseMetaDataTest { - - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void ascDescIndexInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void ascDescIndexInfo() throws SQLException { - if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)) { - return; - } -@@ -1103,9 +1075,8 @@ public class DatabaseMetaDataTest { - assertEquals("D", rs.getString("ASC_OR_DESC")); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void partialIndexInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void partialIndexInfo() throws SQLException { - Statement stmt = con.createStatement(); - stmt.execute("create index idx_p_name_id on metadatatest (name) where id > 5"); - stmt.close(); -@@ -1123,9 +1094,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void remarkIndexInfo(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void remarkIndexInfo() throws SQLException { - Statement stmt = con.createStatement(); - stmt.execute("create index idx_name on metadatatest (name)"); - stmt.execute("comment on index idx_name is 'index_comment'"); -@@ -1143,9 +1113,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void tableTypes(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void tableTypes() throws SQLException { - final List expectedTableTypes = new ArrayList<>(Arrays.asList("FOREIGN TABLE", "INDEX", "PARTITIONED INDEX", - "MATERIALIZED VIEW", "PARTITIONED TABLE", "SEQUENCE", "SYSTEM INDEX", "SYSTEM TABLE", "SYSTEM TOAST INDEX", - "SYSTEM TOAST TABLE", "SYSTEM VIEW", "TABLE", "TEMPORARY INDEX", "TEMPORARY SEQUENCE", "TEMPORARY TABLE", -@@ -1168,9 +1137,8 @@ public class DatabaseMetaDataTest { - assertEquals(foundTableTypes, expectedTableTypes, "The table types received from DatabaseMetaData should match the 18 expected types"); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void funcWithoutNames(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void funcWithoutNames() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - ResultSet rs = dbmd.getProcedureColumns(null, null, "f1", null); -@@ -1194,9 +1162,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void funcWithNames(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void funcWithNames() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getProcedureColumns(null, null, "f2", null); - -@@ -1213,9 +1180,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void funcWithDirection(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void funcWithDirection() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getProcedureColumns(null, null, "f3", null); - -@@ -1237,9 +1203,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void funcReturningComposite(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void funcReturningComposite() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getProcedureColumns(null, null, "f4", null); - -@@ -1277,9 +1242,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void funcReturningTable(BinaryMode binaryMode) throws Exception { -+ @Test -+ void funcReturningTable() throws Exception { - if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { - return; - } -@@ -1297,9 +1261,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void versionColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void versionColumns() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); -@@ -1307,9 +1270,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void bestRowIdentifier(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void bestRowIdentifier() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); -@@ -1324,9 +1286,8 @@ public class DatabaseMetaDataTest { - - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void procedures(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void procedures() throws SQLException { - // At the moment just test that no exceptions are thrown KJ - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); -@@ -1334,9 +1295,8 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void catalogs(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void catalogs() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - try (ResultSet rs = dbmd.getCatalogs()) { - List catalogs = new ArrayList<>(); -@@ -1357,9 +1317,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void schemas(BinaryMode binaryMode) throws Exception { -+ @Test -+ void schemas() throws Exception { - DatabaseMetaData dbmd = con.getMetaData(); - assertNotNull(dbmd); - -@@ -1386,9 +1345,8 @@ public class DatabaseMetaDataTest { - assertFalse(foundEmpty); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void escaping(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void escaping() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getTables(null, null, "a'", new String[]{"TABLE"}); - assertTrue(rs.next()); -@@ -1398,9 +1356,8 @@ public class DatabaseMetaDataTest { - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void searchStringEscape(BinaryMode binaryMode) throws Exception { -+ @Test -+ void searchStringEscape() throws Exception { - DatabaseMetaData dbmd = con.getMetaData(); - String pattern = dbmd.getSearchStringEscape() + "_"; - PreparedStatement pstmt = con.prepareStatement("SELECT 'a' LIKE ?, '_' LIKE ?"); -@@ -1414,9 +1371,8 @@ public class DatabaseMetaDataTest { - pstmt.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDTQualified(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDTQualified() throws Exception { - Statement stmt = null; - try { - stmt = con.createStatement(); -@@ -1469,9 +1425,8 @@ public class DatabaseMetaDataTest { - - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDT1(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDT1() throws Exception { - try { - Statement stmt = con.createStatement(); - stmt.execute("create domain testint8 as int8"); -@@ -1501,9 +1456,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDT2(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDT2() throws Exception { - try { - Statement stmt = con.createStatement(); - stmt.execute("create domain testint8 as int8"); -@@ -1534,9 +1488,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDT3(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDT3() throws Exception { - try { - Statement stmt = con.createStatement(); - stmt.execute("create domain testint8 as int8"); -@@ -1566,9 +1519,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDT4(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDT4() throws Exception { - try { - Statement stmt = con.createStatement(); - stmt.execute("create type testint8 as (i int8)"); -@@ -1596,9 +1548,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getUDT5(BinaryMode binaryMode) throws Exception { -+ @Test -+ void getUDT5() throws Exception { - try { - Statement stmt = con.createStatement(); - stmt.execute("create type testint8 as (i int8)"); -@@ -1622,9 +1573,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void types(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void types() throws SQLException { - // https://www.postgresql.org/docs/8.2/static/datatype.html - List stringTypeList = new ArrayList<>(); - stringTypeList.addAll(Arrays.asList("bit", -@@ -1684,9 +1634,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void typeInfoSigned(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void typeInfoSigned() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getTypeInfo(); - while (rs.next()) { -@@ -1700,9 +1649,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void typeInfoQuoting(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void typeInfoQuoting() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getTypeInfo(); - while (rs.next()) { -@@ -1715,17 +1663,15 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void informationAboutArrayTypes_whenCatalogSchemaColumnNamePatternArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void informationAboutArrayTypes_whenCatalogSchemaColumnNamePatternArgsEmpty_expectNoResults() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns("", "", "arraytable", ""); - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void informationAboutArrayTypes(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void informationAboutArrayTypes() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "arraytable", null); - assertTrue(rs.next()); -@@ -1738,9 +1684,8 @@ public class DatabaseMetaDataTest { - assertFalse(rs.next()); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void primaryKeysWithIncludeColumns_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void primaryKeysWithIncludeColumns_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws SQLException { - String tableName = "pk_include_column"; - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - DatabaseMetaData dbmd = con.getMetaData(); -@@ -1749,9 +1694,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void primaryKeysWithIncludeColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void primaryKeysWithIncludeColumns() throws SQLException { - String tableName = "pk_include_column"; - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - DatabaseMetaData dbmd = con.getMetaData(); -@@ -1769,9 +1713,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void partitionedTablesIndex_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void partitionedTablesIndex_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws SQLException { - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - try (Statement stmt = con.createStatement()) { - stmt.execute( -@@ -1785,9 +1728,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void partitionedTablesIndex(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void partitionedTablesIndex() throws SQLException { - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - try (Statement stmt = con.createStatement()) { - stmt.execute( -@@ -1802,9 +1744,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void partitionedTables_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void partitionedTables_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws SQLException { - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - try (Statement stmt = con.createStatement()) { - stmt.execute( -@@ -1821,9 +1762,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void partitionedTables(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void partitionedTables() throws SQLException { - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) { - try (Statement stmt = con.createStatement()) { - stmt.execute( -@@ -1842,9 +1782,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void identityColumns_whenCatalogAndSchemaArgsEmpty_expectNoResults(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void identityColumns_whenCatalogAndSchemaArgsEmpty_expectNoResults() throws SQLException { - if ( TestUtil.haveMinimumServerVersion(con, ServerVersion.v10) ) { - try (Statement stmt = con.createStatement()) { - stmt.execute("CREATE TABLE test_new (" -@@ -1859,9 +1798,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void identityColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void identityColumns() throws SQLException { - if ( TestUtil.haveMinimumServerVersion(con, ServerVersion.v10) ) { - try (Statement stmt = con.createStatement()) { - stmt.execute("CREATE TABLE test_new (" -@@ -1878,9 +1816,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void generatedColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void generatedColumns() throws SQLException { - if ( TestUtil.haveMinimumServerVersion(con, ServerVersion.v12) ) { - DatabaseMetaData dbmd = con.getMetaData(); - ResultSet rs = dbmd.getColumns(null, null, "employee", "gross_pay"); -@@ -1890,9 +1827,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void getSQLKeywords(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void getSQLKeywords() throws SQLException { - DatabaseMetaData dbmd = con.getMetaData(); - String keywords = dbmd.getSQLKeywords(); - -@@ -1961,9 +1897,8 @@ public class DatabaseMetaDataTest { - } - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void functionColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void functionColumns() throws SQLException { - if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { - return; - } -@@ -2026,10 +1961,9 @@ public class DatabaseMetaDataTest { - rs.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void smallSerialColumns(BinaryMode binaryMode) throws SQLException { -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_2)); -+ @Test -+ void smallSerialColumns() throws SQLException { -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_2)); - TestUtil.createTable(con, "smallserial_test", "a smallserial"); - - DatabaseMetaData dbmd = con.getMetaData(); -@@ -2047,9 +1981,8 @@ public class DatabaseMetaDataTest { - TestUtil.dropTable(con, "smallserial_test"); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void smallSerialSequenceLikeColumns(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void smallSerialSequenceLikeColumns() throws SQLException { - Statement stmt = con.createStatement(); - // This is the equivalent of the smallserial, not the actual smallserial - stmt.execute("CREATE SEQUENCE smallserial_test_a_seq;\n" -@@ -2079,9 +2012,8 @@ public class DatabaseMetaDataTest { - stmt.close(); - } - -- @MethodSource("data") -- @ParameterizedTest(name = "binary = {0}") -- void upperCaseMetaDataLabels(BinaryMode binaryMode) throws SQLException { -+ @Test -+ void upperCaseMetaDataLabels() throws SQLException { - ResultSet rs = con.getMetaData().getTables(null, null, null, null); - ResultSetMetaData rsmd = rs.getMetaData(); - -diff --git a/src/test/java/org/postgresql/test/jdbc2/DateStyleTest.java b/src/test/java/org/postgresql/test/jdbc2/DateStyleTest.java -index b3f4d75..7a27032 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/DateStyleTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/DateStyleTest.java -@@ -5,28 +5,30 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.fail; -+ - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.Parameter; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.SQLException; - import java.sql.Statement; - import java.util.Arrays; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "dateStyle={0}, shouldPass={1}") -+@MethodSource("data") - public class DateStyleTest extends BaseTest4 { - -- @Parameterized.Parameter(0) -+ @Parameter(0) - public String dateStyle; - -- @Parameterized.Parameter(1) -+ @Parameter(1) - public boolean shouldPass; - -- @Parameterized.Parameters(name = "dateStyle={0}, shouldPass={1}") - public static Iterable data() { - return Arrays.asList(new Object[][]{ - {"iso, mdy", true}, -@@ -42,7 +44,7 @@ public class DateStyleTest extends BaseTest4 { - try { - st.execute("set DateStyle='" + dateStyle + "'"); - if (!shouldPass) { -- Assert.fail("Set DateStyle=" + dateStyle + " should not be allowed"); -+ fail("Set DateStyle=" + dateStyle + " should not be allowed"); - } - } catch (SQLException e) { - if (shouldPass) { -diff --git a/src/test/java/org/postgresql/test/jdbc2/DateTest.java b/src/test/java/org/postgresql/test/jdbc2/DateTest.java -index 44be78f..a4ccb9b 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/DateTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/DateTest.java -@@ -5,18 +5,17 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.test.TestUtil; - --import org.junit.After; --import org.junit.Before; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -31,12 +30,12 @@ import java.util.TimeZone; - import java.util.stream.IntStream; - import java.util.stream.Stream; - --/* -+/** - * Some simple tests based on problems reported by users. Hopefully these will help prevent previous - * problems from re-occurring ;-) -- * - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "type = {0}, zoneId = {1}, binary = {2}") -+@MethodSource("data") - public class DateTest extends BaseTest4 { - private static final TimeZone saveTZ = TimeZone.getDefault(); - -@@ -50,7 +49,6 @@ public class DateTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "type = {0}, zoneId = {1}, binary = {2}") - public static Iterable data() { - final List data = new ArrayList<>(); - for (String type : Arrays.asList("date", "timestamp", "timestamptz")) { -@@ -68,26 +66,25 @@ public class DateTest extends BaseTest4 { - return data; - } - -- @Before -+ @Override - public void setUp() throws Exception { - super.setUp(); - TestUtil.createTable(con, "test", "dt ".concat(type)); - } - -- @After -+ @Override - public void tearDown() throws SQLException { - TimeZone.setDefault(saveTZ); - TestUtil.dropTable(con, "test"); - super.tearDown(); - } - -- /* -+ /** - * Tests the time methods in ResultSet - */ - @Test - public void testGetDate() throws SQLException { -- assumeTrue("TODO: Test fails on some server versions with local time zones (not GMT based)", -- false == Objects.equals(type, "timestamptz") || zoneId.startsWith("GMT")); -+ assumeTrue(!Objects.equals(type, "timestamptz") || zoneId.startsWith("GMT"), "TODO: Test fails on some server versions with local time zones (not GMT based)"); - try (Statement stmt = con.createStatement()) { - assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("test", "'1950-02-07'"))); - assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("test", "'1970-06-02'"))); -@@ -118,7 +115,7 @@ public class DateTest extends BaseTest4 { - } - } - -- /* -+ /** - * Tests the time methods in PreparedStatement - */ - @Test -@@ -199,7 +196,7 @@ public class DateTest extends BaseTest4 { - } - } - -- /* -+ /** - * Helper for the date tests. It tests what should be in the db - */ - private void dateTest() throws SQLException { -@@ -315,7 +312,7 @@ public class DateTest extends BaseTest4 { - assertNotNull(d); - assertEquals(makeDate(0, 12, 31), d); - -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - - rs.close(); - st.close(); -diff --git a/src/test/java/org/postgresql/test/jdbc2/EnumTest.java b/src/test/java/org/postgresql/test/jdbc2/EnumTest.java -index b6bc331..afd1d0c 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/EnumTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/EnumTest.java -@@ -5,12 +5,14 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+ - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Array; - import java.sql.PreparedStatement; -@@ -20,13 +22,13 @@ import java.util.ArrayList; - import java.util.Arrays; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class EnumTest extends BaseTest4 { - public EnumTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -53,19 +55,17 @@ public class EnumTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - rs.next(); - Array array = rs.getArray(1); -- Assert.assertNotNull("{duplicate,new} should come up as a non-null array", array); -+ assertNotNull(array, "{duplicate,new} should come up as a non-null array"); - Object[] objectArray = (Object[]) array.getArray(); -- Assert.assertEquals( -- "{duplicate,new} should come up as Java array with two entries", -+ assertEquals( - "[duplicate, new]", -- Arrays.deepToString(objectArray) -- ); -+ Arrays.deepToString(objectArray), -+ "{duplicate,new} should come up as Java array with two entries"); - -- Assert.assertEquals( -- "Enum array entries should come up as strings", -+ assertEquals( - "java.lang.String, java.lang.String", -- objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName() -- ); -+ objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName(), -+ "Enum array entries should come up as strings"); - rs.close(); - pstmt.close(); - } -@@ -77,19 +77,17 @@ public class EnumTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - rs.next(); - Array array = rs.getArray(1); -- Assert.assertNotNull(value + " should come up as a non-null array", array); -+ assertNotNull(array, value + " should come up as a non-null array"); - Object[] objectArray = (Object[]) array.getArray(); -- Assert.assertEquals( -- value + " should come up as Java array with two entries", -+ assertEquals( - "[[duplicate, new], [spike, spike]]", -- Arrays.deepToString(objectArray) -- ); -+ Arrays.deepToString(objectArray), -+ () -> value + " should come up as Java array with two entries"); - -- Assert.assertEquals( -- "Enum array entries should come up as strings", -+ assertEquals( - "[Ljava.lang.String;, [Ljava.lang.String;", -- objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName() -- ); -+ objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName(), -+ "Enum array entries should come up as strings"); - rs.close(); - pstmt.close(); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/GeometricTest.java b/src/test/java/org/postgresql/test/jdbc2/GeometricTest.java -index 38f0794..f23a64a 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/GeometricTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/GeometricTest.java -@@ -5,9 +5,9 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.core.ServerVersion; - import org.postgresql.geometric.PGbox; -@@ -21,9 +21,9 @@ import org.postgresql.test.TestUtil; - import org.postgresql.util.PGobject; - import org.postgresql.util.PSQLException; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -33,17 +33,17 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.List; - --/* -+/** - * Test case for geometric type I/O - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class GeometricTest extends BaseTest4 { - - public GeometricTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -73,10 +73,10 @@ public class GeometricTest extends BaseTest4 { - Statement stmt = con.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT " + column + " FROM testgeometric"); - assertTrue(rs.next()); -- assertEquals("PGObject#equals(rs.getObject)", obj, rs.getObject(1)); -+ assertEquals(obj, rs.getObject(1), "PGObject#equals(rs.getObject)"); - PGobject obj2 = (PGobject) obj.clone(); - obj2.setValue(rs.getString(1)); -- assertEquals("PGobject.toString vs rs.getString", obj, obj2); -+ assertEquals(obj, obj2, "PGobject.toString vs rs.getString"); - rs.close(); - - stmt.executeUpdate("DELETE FROM testgeometric"); -diff --git a/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest.java b/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest.java -index d1cea18..10f3fb9 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest.java -@@ -5,14 +5,14 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - - import org.postgresql.PGProperty; - import org.postgresql.core.Oid; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.math.BigDecimal; - import java.sql.PreparedStatement; -@@ -23,7 +23,8 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class NumericTransferTest extends BaseTest4 { - public NumericTransferTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); -@@ -35,7 +36,6 @@ public class NumericTransferTest extends BaseTest4 { - PGProperty.BINARY_TRANSFER_ENABLE.set(props, Oid.NUMERIC); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -54,12 +54,12 @@ public class NumericTransferTest extends BaseTest4 { - rs.next(); - if (i == 0) { - final String expected = sign + "1"; -- assertEquals("getString for " + sql, expected, rs.getString(1)); -- assertEquals("getBigDecimal for " + sql, expected, rs.getBigDecimal(1).toString()); -+ assertEquals(expected, rs.getString(1), () -> "getString for " + sql); -+ assertEquals(expected, rs.getBigDecimal(1).toString(), () -> "getBigDecimal for " + sql); - } else { - final String expected = sign + String.format("1%0" + i + "d", 0); -- assertEquals("getString for " + sql, expected, rs.getString(1)); -- assertEquals("getBigDecimal for " + sql, expected, rs.getBigDecimal(1).toString()); -+ assertEquals(expected, rs.getString(1), () -> "getString for " + sql); -+ assertEquals(expected, rs.getBigDecimal(1).toString(), () -> "getBigDecimal for " + sql); - } - rs.close(); - } -@@ -76,8 +76,14 @@ public class NumericTransferTest extends BaseTest4 { - statement.setBigDecimal(1, new BigDecimal(expected)); - ResultSet rs = statement.executeQuery(); - rs.next(); -- assertEquals("getString for " + expected, expected, rs.getString(1)); -- assertEquals("getBigDecimal for " + expected, expected, rs.getBigDecimal(1).toString()); -+ assertEquals( -+ expected, -+ rs.getString(1), -+ () -> "getString for " + expected); -+ assertEquals( -+ expected, -+ rs.getBigDecimal(1).toString(), -+ () -> "getBigDecimal for " + expected); - rs.close(); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest2.java b/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest2.java -deleted file mode 100644 -index 7a2962a..0000000 ---- a/src/test/java/org/postgresql/test/jdbc2/NumericTransferTest2.java -+++ /dev/null -@@ -1,114 +0,0 @@ --/* -- * Copyright (c) 2020, PostgreSQL Global Development Group -- * See the LICENSE file in the project root for more information. -- */ -- --package org.postgresql.test.jdbc2; -- --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; -- --import org.postgresql.PGProperty; --import org.postgresql.core.Oid; -- --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -- --import java.math.BigDecimal; --import java.math.BigInteger; --import java.sql.PreparedStatement; --import java.sql.ResultSet; --import java.sql.SQLException; --import java.sql.Statement; --import java.util.ArrayList; --import java.util.Collection; --import java.util.Properties; -- --@RunWith(Parameterized.class) --public class NumericTransferTest2 extends BaseTest4 { -- -- final BigDecimal value; -- -- public NumericTransferTest2(BinaryMode binaryMode, BigDecimal value) { -- setBinaryMode(binaryMode); -- this.value = value; -- } -- -- @Override -- protected void updateProperties(Properties props) { -- super.updateProperties(props); -- PGProperty.BINARY_TRANSFER_ENABLE.set(props, Oid.NUMERIC); -- } -- -- @Parameterized.Parameters(name = "binary = {0}, value = {1,number,#,###.##################################################}") -- public static Iterable data() { -- Collection numbers = new ArrayList<>(); -- for (BinaryMode binaryMode : BinaryMode.values()) { -- numbers.add(new Object[]{binaryMode, new BigDecimal("1.0")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("0.000000000000000000000000000000000000000000000000000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("0.100000000000000000000000000000000000000000000009900")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-1.0")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-1")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("1.2")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-2.05")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("0.000000000000000000000000000990")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-0.000000000000000000000000000990")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("10.0000000000099")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal(".10000000000000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("1.10000000000000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("99999.2")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("99999")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-99999.2")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-99999")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("2147483647")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-2147483648")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("2147483648")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-2147483649")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("9223372036854775807")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-9223372036854775808")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("9223372036854775808")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-9223372036854775809")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("10223372036850000000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("19223372036854775807")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("19223372036854775807.300")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("-19223372036854775807.300")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal(BigInteger.valueOf(1234567890987654321L), -1)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal(BigInteger.valueOf(1234567890987654321L), -5)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal(BigInteger.valueOf(-1234567890987654321L), -3)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal(BigInteger.valueOf(6), -8)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("30000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("40000").setScale(15)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("20000.00000000000000000000")}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("9990000").setScale(10)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("1000000").setScale(20)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("10000000000000000000000000000000000000").setScale(20)}); -- numbers.add(new Object[]{binaryMode, new BigDecimal("90000000000000000000000000000000000000")}); -- } -- return numbers; -- } -- -- @Test -- public void receiveValue() throws SQLException { -- final String valString = value.toPlainString(); -- try (Statement statement = con.createStatement()) { -- final String sql = "SELECT " + valString + "::numeric"; -- try (ResultSet rs = statement.executeQuery(sql)) { -- assertTrue(rs.next()); -- assertEquals("getBigDecimal for " + sql, valString, rs.getBigDecimal(1).toPlainString()); -- } -- } -- } -- -- @Test -- public void sendReceiveValue() throws SQLException { -- final String valString = value.toPlainString(); -- try (PreparedStatement statement = con.prepareStatement("select ?::numeric")) { -- statement.setBigDecimal(1, value); -- try (ResultSet rs = statement.executeQuery()) { -- rs.next(); -- assertEquals("getBigDecimal for " + valString, valString, rs.getBigDecimal(1).toPlainString()); -- } -- } -- } --} -diff --git a/src/test/java/org/postgresql/test/jdbc2/OuterJoinSyntaxTest.java b/src/test/java/org/postgresql/test/jdbc2/OuterJoinSyntaxTest.java -index 1511545..a440cc9 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/OuterJoinSyntaxTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/OuterJoinSyntaxTest.java -@@ -5,10 +5,11 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.ResultSet; - import java.sql.Statement; -@@ -104,7 +105,7 @@ public class OuterJoinSyntaxTest extends BaseTest4 { - try { - final ResultSet rs = st.executeQuery(theQuery); - try { -- Assert.assertEquals("SQL " + theQuery, TestUtil.join(TestUtil.resultSetToLines(rs)), TestUtil.join(expectedResult)); -+ assertEquals(TestUtil.join(TestUtil.resultSetToLines(rs)), TestUtil.join(expectedResult), "SQL " + theQuery); - } finally { - TestUtil.closeQuietly(rs); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/PGObjectGetTest.java b/src/test/java/org/postgresql/test/jdbc2/PGObjectGetTest.java -index 3ad7ad2..bab9ccc 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/PGObjectGetTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/PGObjectGetTest.java -@@ -5,8 +5,8 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNull; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNull; - - import org.postgresql.geometric.PGbox; - import org.postgresql.geometric.PGcircle; -@@ -20,9 +20,9 @@ import org.postgresql.util.PGmoney; - import org.postgresql.util.PGobject; - - // import org.checkerframework.checker.nullness.qual.Nullable; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -30,7 +30,8 @@ import java.sql.SQLException; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, sql = {1}, type = {2}") -+@MethodSource("data") - public class PGObjectGetTest extends BaseTest4 { - private final String sqlExpression; - private final Class type; -@@ -46,7 +47,6 @@ public class PGObjectGetTest extends BaseTest4 { - this.stringValue = stringValue; - } - -- @Parameterized.Parameters(name = "binary = {0}, sql = {1}, type = {2}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -90,10 +90,9 @@ public class PGObjectGetTest extends BaseTest4 { - ResultSet rs = ps.executeQuery(); - rs.next(); - assertEquals( -- "'" + sqlExpression + "'.getString(1)", - stringValue, -- rs.getString(1) -- ); -+ rs.getString(1), -+ () -> "'" + sqlExpression + "'.getString(1)"); - } - - private void testGet(final String s, String expected, Class type) throws SQLException { -@@ -101,22 +100,19 @@ public class PGObjectGetTest extends BaseTest4 { - ResultSet rs = ps.executeQuery(); - rs.next(); - assertEquals( -- "'" + s + "'.getObject(1, " + type.getSimpleName() + ".class)", - expected, -- printObject(rs.getObject(1, type)) -- ); -+ printObject(rs.getObject(1, type)), -+ () -> "'" + s + "'.getObject(1, " + type.getSimpleName() + ".class)"); - if (expected.contains("value=null)")) { - // For some reason we return objects as nulls - assertNull( -- "'select " + s + "'.getObject(1)", -- rs.getObject(1) -- ); -+ rs.getObject(1), -+ () -> "'select " + s + "'.getObject(1)"); - } else { - assertEquals( -- "'select " + s + "'.getObject(1)", - expected, -- printObject(rs.getObject(1)) -- ); -+ printObject(rs.getObject(1)), -+ () -> "'select " + s + "'.getObject(1)"); - } - } - -diff --git a/src/test/java/org/postgresql/test/jdbc2/PGObjectSetTest.java b/src/test/java/org/postgresql/test/jdbc2/PGObjectSetTest.java -index 27c7f75..2697bcd 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/PGObjectSetTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/PGObjectSetTest.java -@@ -5,9 +5,9 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.geometric.PGbox; - import org.postgresql.geometric.PGcircle; -@@ -21,9 +21,9 @@ import org.postgresql.util.PGmoney; - import org.postgresql.util.PGobject; - - // import org.checkerframework.checker.nullness.qual.Nullable; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.lang.reflect.InvocationTargetException; - import java.sql.PreparedStatement; -@@ -32,7 +32,8 @@ import java.sql.SQLException; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, sql = {2}, type = {1}") -+@MethodSource("data") - public class PGObjectSetTest extends BaseTest4 { - private final String typeName; - private final String expected; -@@ -46,7 +47,6 @@ public class PGObjectSetTest extends BaseTest4 { - this.typeName = typeName; - } - -- @Parameterized.Parameters(name = "binary = {0}, sql = {2}, type = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -79,7 +79,7 @@ public class PGObjectSetTest extends BaseTest4 { - PGobject object = new PGobject(); - object.setType(typeName); - object.setValue(null); -- assertTrue("IsNull should return true", object.isNull()); -+ assertTrue(object.isNull(), "IsNull should return true"); - testSet(object, expected, PGobject.class); - } - -@@ -101,20 +101,20 @@ public class PGObjectSetTest extends BaseTest4 { - ResultSet rs = ps.executeQuery(); - rs.next(); - assertEquals( -- "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1, " + type.getSimpleName() + ".class)", - expected, -- printObject(rs.getObject(1, type)) -+ printObject(rs.getObject(1, type)), -+ () -> "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1, " + type.getSimpleName() + ".class)" - ); - if (expected.contains("value=null)")) { - assertNull( -- "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1)", -- rs.getObject(1) -+ rs.getObject(1), -+ () -> "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1)" - ); - } else { - assertEquals( -- "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1)", - expected, -- printObject(rs.getObject(1)) -+ printObject(rs.getObject(1)), -+ () -> "'select ?::" + value.getType() + "'.withParam(" + printObject(value) + ").getObject(1)" - ); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/PGTimeTest.java b/src/test/java/org/postgresql/test/jdbc2/PGTimeTest.java -index 31ff709..8978060 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/PGTimeTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/PGTimeTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.test.TestUtil; - import org.postgresql.util.PGInterval; - import org.postgresql.util.PGTime; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -diff --git a/src/test/java/org/postgresql/test/jdbc2/ParameterStatusTest.java b/src/test/java/org/postgresql/test/jdbc2/ParameterStatusTest.java -index 4bb0a0a..7d5d93b 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ParameterStatusTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ParameterStatusTest.java -@@ -5,6 +5,11 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertThrows; -+ - import org.postgresql.PGConnection; - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; -@@ -12,8 +17,7 @@ import org.postgresql.test.annotations.DisabledIfServerVersionBelow; - - import org.hamcrest.MatcherAssert; - import org.hamcrest.core.StringStartsWith; --import org.junit.Assert; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Statement; - import java.util.Map; -@@ -46,40 +50,40 @@ public class ParameterStatusTest extends BaseTest4 { - Map params = ((PGConnection) con).getParameterStatuses(); - - // PgJDBC forces the following parameters -- Assert.assertEquals("UTF8", params.get("client_encoding")); -- Assert.assertNotNull(params.get("DateStyle")); -+ assertEquals("UTF8", params.get("client_encoding")); -+ assertNotNull(params.get("DateStyle")); - MatcherAssert.assertThat(params.get("DateStyle"), StringStartsWith.startsWith("ISO")); - - // PgJDBC sets TimeZone via Java's TimeZone.getDefault() - // Pg reports POSIX timezones which are negated, so: -- Assert.assertEquals("GMT-08:00", params.get("TimeZone")); -+ assertEquals("GMT-08:00", params.get("TimeZone")); - - // Must be reported. All these exist in 8.2 or above, and we don't bother - // with test coverage older than that. -- Assert.assertNotNull(params.get("integer_datetimes")); -- Assert.assertNotNull(params.get("is_superuser")); -- Assert.assertNotNull(params.get("server_encoding")); -- Assert.assertNotNull(params.get("server_version")); -- Assert.assertNotNull(params.get("session_authorization")); -- Assert.assertNotNull(params.get("standard_conforming_strings")); -+ assertNotNull(params.get("integer_datetimes")); -+ assertNotNull(params.get("is_superuser")); -+ assertNotNull(params.get("server_encoding")); -+ assertNotNull(params.get("server_version")); -+ assertNotNull(params.get("session_authorization")); -+ assertNotNull(params.get("standard_conforming_strings")); - - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { -- Assert.assertNotNull(params.get("IntervalStyle")); -+ assertNotNull(params.get("IntervalStyle")); - } else { -- Assert.assertNull(params.get("IntervalStyle")); -+ assertNull(params.get("IntervalStyle")); - } - - // TestUtil forces "ApplicationName=Driver Tests" - // if application_name is supported (9.0 or newer) - if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_0)) { -- Assert.assertEquals("Driver Tests", params.get("application_name")); -+ assertEquals("Driver Tests", params.get("application_name")); - } else { -- Assert.assertNull(params.get("application_name")); -+ assertNull(params.get("application_name")); - } - - // Not reported -- Assert.assertNull(params.get("nonexistent")); -- Assert.assertNull(params.get("enable_hashjoin")); -+ assertNull(params.get("nonexistent")); -+ assertNull(params.get("enable_hashjoin")); - - TestUtil.closeDB(con); - } -@@ -92,7 +96,7 @@ public class ParameterStatusTest extends BaseTest4 { - con = TestUtil.openDB(properties); - - Map params = ((PGConnection) con).getParameterStatuses(); -- Assert.assertEquals("Driver Tests", params.get("application_name")); -+ assertEquals("Driver Tests", params.get("application_name")); - - TestUtil.closeDB(con); - } -@@ -105,7 +109,7 @@ public class ParameterStatusTest extends BaseTest4 { - con = TestUtil.openDB(properties); - - Map params = ((PGConnection) con).getParameterStatuses(); -- Assert.assertEquals("Driver Tests", params.get("application_name")); -+ assertEquals("Driver Tests", params.get("application_name")); - - TestUtil.closeDB(con); - } -@@ -127,7 +131,7 @@ public class ParameterStatusTest extends BaseTest4 { - - // Parameter status should be reported before the ReadyForQuery so we will - // have already processed it -- Assert.assertEquals("pgjdbc_ParameterStatusTest2", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("pgjdbc_ParameterStatusTest2", ((PGConnection) con).getParameterStatus("application_name")); - - TestUtil.closeDB(con); - } -@@ -138,17 +142,17 @@ public class ParameterStatusTest extends BaseTest4 { - Statement stmt = con.createStatement(); - - // Initial value assigned by TestUtil -- Assert.assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); - - // PgJDBC begins an explicit txn here due to autocommit=off so the effect - // should be lost on rollback but retained on commit per the docs. - stmt.executeUpdate("SET application_name = 'pgjdbc_ParameterStatusTestTxn';"); -- Assert.assertEquals("pgjdbc_ParameterStatusTestTxn", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("pgjdbc_ParameterStatusTestTxn", ((PGConnection) con).getParameterStatus("application_name")); - - // SET LOCAL is always txn scoped so the effect here will always be - // unwound on txn end. - stmt.executeUpdate("SET LOCAL application_name = 'pgjdbc_ParameterStatusTestLocal';"); -- Assert.assertEquals("pgjdbc_ParameterStatusTestLocal", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("pgjdbc_ParameterStatusTestLocal", ((PGConnection) con).getParameterStatus("application_name")); - - stmt.close(); - } -@@ -169,7 +173,7 @@ public class ParameterStatusTest extends BaseTest4 { - // SET unwinds on ROLLBACK - con.rollback(); - -- Assert.assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); - - TestUtil.closeDB(con); - } -@@ -190,7 +194,7 @@ public class ParameterStatusTest extends BaseTest4 { - // SET is retained on commit but SET LOCAL is unwound - con.commit(); - -- Assert.assertEquals("pgjdbc_ParameterStatusTestTxn", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("pgjdbc_ParameterStatusTestTxn", ((PGConnection) con).getParameterStatus("application_name")); - - TestUtil.closeDB(con); - } -@@ -208,21 +212,23 @@ public class ParameterStatusTest extends BaseTest4 { - Statement stmt = con.createStatement(); - - // A SET LOCAL in autocommit should have no visible effect as we report the reset value too -- Assert.assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); - stmt.executeUpdate("SET LOCAL application_name = 'pgjdbc_ParameterStatusTestLocal';"); -- Assert.assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); -+ assertEquals("Driver Tests", ((PGConnection) con).getParameterStatus("application_name")); - - stmt.close(); - TestUtil.closeDB(con); - } - -- @Test(expected = UnsupportedOperationException.class) -+ @Test - public void parameterMapReadOnly() throws Exception { - try { - con = TestUtil.openDB(); - Map params = ((PGConnection) con).getParameterStatuses(); -- params.put("DateStyle", "invalid"); -- Assert.fail("Attempt to write to exposed parameters map must throw"); -+ assertThrows( -+ UnsupportedOperationException.class, -+ () -> params.put("DateStyle", "invalid"), -+ "con..getParameterStatuses().put(...) should fail as the map should be read-only"); - } finally { - TestUtil.closeDB(con); - } -@@ -241,9 +247,9 @@ public class ParameterStatusTest extends BaseTest4 { - - Statement stmt = con.createStatement(); - -- Assert.assertEquals("Driver Tests", params.get("application_name")); -+ assertEquals("Driver Tests", params.get("application_name")); - stmt.executeUpdate("SET application_name = 'pgjdbc_paramstatus_view';"); -- Assert.assertEquals("pgjdbc_paramstatus_view", params.get("application_name")); -+ assertEquals("pgjdbc_paramstatus_view", params.get("application_name")); - - stmt.close(); - TestUtil.closeDB(con); -diff --git a/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java b/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java -index 89435a2..dc202fc 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java -@@ -5,13 +5,17 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertThrows; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; - import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertSame; -+import static org.junit.jupiter.api.Assertions.assertThrows; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeFalse; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGStatement; - import org.postgresql.core.ServerVersion; -@@ -23,11 +27,9 @@ import org.postgresql.test.util.BrokenInputStream; - import org.postgresql.util.GT; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.io.ByteArrayInputStream; - import java.io.ByteArrayOutputStream; -@@ -55,7 +57,8 @@ import java.util.logging.Level; - import java.util.logging.LogRecord; - import java.util.logging.Logger; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class PreparedStatementTest extends BaseTest4 { - - private static final int NUMERIC_MAX_PRECISION = 1000; -@@ -65,7 +68,6 @@ public class PreparedStatementTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -202,17 +204,27 @@ public class PreparedStatementTest extends BaseTest4 { - - private void runBrokenStream(InputStream is, int length) throws SQLException, IOException { - assertThrows( -- "the provided stream length is " + length -- + ", and the number of available bytes on stream length is " + is.available() -- + ", so the bind should fail", -- SQLException.class, () -> { -+ SQLException.class, -+ () -> { - try (PreparedStatement pstmt = - con.prepareStatement("INSERT INTO streamtable (bin,str) VALUES (?,?)");) { - pstmt.setBinaryStream(1, is, length); - pstmt.setString(2, "Other"); - pstmt.executeUpdate(); - } -- }); -+ }, -+ () -> { -+ String available; -+ try { -+ available = String.valueOf(is.available()); -+ } catch (IOException e) { -+ available = "exception from .available(): " + e.getMessage(); -+ } -+ return "the provided stream length is " + length -+ + ", and the number of available bytes on stream length is " + available -+ + ", so the bind should fail"; -+ } -+ ); - // verify the connection is still valid and the row didn't go in. - try (Statement stmt = con.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM streamtable");) { -@@ -248,38 +260,26 @@ public class PreparedStatementTest extends BaseTest4 { - ByteArrayInputStream byteStream = new ByteArrayInputStream(buf); - - pstmt.setBinaryStream(1, byteStream, buf.length); -- assertEquals( -- "InputStream parameter should come as ?, and the second parameter is unset, so it should be ? as well", -- "INSERT INTO streamtable VALUES (?,?)", -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed with half-set parameters")); -+ assertEquals("INSERT INTO streamtable VALUES (?,?)", assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed with half-set parameters"), "InputStream parameter should come as ?, and the second parameter is unset, so it should be ? as well"); - - pstmt.setString(2, "test"); - - String expected = "INSERT INTO streamtable VALUES (?,('test'))"; -- assertEquals( -- "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed after setting parameters")); -- -- assertEquals( -- "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "Second PreparedStatement#toString call should succeed as well")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed after setting parameters"), "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet"); -+ -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "Second PreparedStatement#toString call should succeed as well"), "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet"); - - pstmt.execute(); - -- assertEquals( -- "PreparedStatement#toString after .execute()", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed even after execute()")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed even after execute()"), "PreparedStatement#toString after .execute()"); - } - } - -@@ -297,28 +297,19 @@ public class PreparedStatementTest extends BaseTest4 { - - String expected = "INSERT INTO streamtable VALUES (?,('line1'));\n" - + "INSERT INTO streamtable VALUES (?,('line2'))"; -- assertEquals( -- "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed after addBatch")); -- -- assertEquals( -- "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "Second PreparedStatement#toString call should succeed as well")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed after addBatch"), "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet"); -+ -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "Second PreparedStatement#toString call should succeed as well"), "InputStream parameter should come as ? when calling PreparedStatement#toString as we can't process input stream twice yet"); - - pstmt.executeBatch(); - -- assertEquals( -- "PreparedStatement#toString after executeBatch() seem to equal to the latest parameter row", -- "INSERT INTO streamtable VALUES (?,('line2'))", -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed even after executeBatch()")); -+ assertEquals("INSERT INTO streamtable VALUES (?,('line2'))", assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed even after executeBatch()"), "PreparedStatement#toString after executeBatch() seem to equal to the latest parameter row"); - } - } - -@@ -331,38 +322,26 @@ public class PreparedStatementTest extends BaseTest4 { - - pstmt.setBytes(1, buf); - -- assertEquals( -- "byte[] parameter could be rendered, and the second parameter is unset, so it should be ? as well", -- "INSERT INTO streamtable VALUES ('\\x00010203040506070809'::bytea,?)", -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed with half-set parameters")); -+ assertEquals("INSERT INTO streamtable VALUES ('\\x00010203040506070809'::bytea,?)", assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed with half-set parameters"), "byte[] parameter could be rendered, and the second parameter is unset, so it should be ? as well"); - - pstmt.setString(2, "test"); - - String expected = "INSERT INTO streamtable VALUES ('\\x00010203040506070809'::bytea,('test'))"; -- assertEquals( -- "byte[] should be rendered when calling PreparedStatement#toString", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed after setting parameters")); -- -- assertEquals( -- "byte[] should be rendered when calling PreparedStatement#toString", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "Second PreparedStatement#toString call should succeed as well")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed after setting parameters"), "byte[] should be rendered when calling PreparedStatement#toString"); -+ -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "Second PreparedStatement#toString call should succeed as well"), "byte[] should be rendered when calling PreparedStatement#toString"); - - pstmt.execute(); - -- assertEquals( -- "PreparedStatement#toString after .execute()", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed even after execute()")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed even after execute()"), "PreparedStatement#toString after .execute()"); - } - } - -@@ -381,28 +360,19 @@ public class PreparedStatementTest extends BaseTest4 { - - String expected = "INSERT INTO streamtable VALUES ('\\x0001'::bytea,('line1'));\n" - + "INSERT INTO streamtable VALUES ('\\x000102'::bytea,('line2'))"; -- assertEquals( -- "byte[] should be rendered when calling PreparedStatement#toString", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed after addBatch")); -- -- assertEquals( -- "byte[] should be rendered when calling PreparedStatement#toString", -- expected, -- assertDoesNotThrow( -- pstmt::toString, -- "Second PreparedStatement#toString call should succeed as well")); -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed after addBatch"), "byte[] should be rendered when calling PreparedStatement#toString"); -+ -+ assertEquals(expected, assertDoesNotThrow( -+ pstmt::toString, -+ "Second PreparedStatement#toString call should succeed as well"), "byte[] should be rendered when calling PreparedStatement#toString"); - - pstmt.executeBatch(); - -- assertEquals( -- "PreparedStatement#toString after executeBatch() seem to equal to the latest parameter row", -- "INSERT INTO streamtable VALUES ('\\x000102'::bytea,('line2'))", -- assertDoesNotThrow( -- pstmt::toString, -- "PreparedStatement#toString call should succeed even after executeBatch()")); -+ assertEquals("INSERT INTO streamtable VALUES ('\\x000102'::bytea,('line2'))", assertDoesNotThrow( -+ pstmt::toString, -+ "PreparedStatement#toString call should succeed even after executeBatch()"), "PreparedStatement#toString after executeBatch() seem to equal to the latest parameter row"); - } - } - -@@ -438,12 +408,12 @@ public class PreparedStatementTest extends BaseTest4 { - ps.setInt(1, 100500); - ps.execute(); - ResultSet rs = ps.getResultSet(); -- Assert.assertNull("insert produces no results ==> getResultSet should be null", rs); -- Assert.assertTrue("There are two statements => getMoreResults should be true", ps.getMoreResults()); -+ assertNull(rs, "insert produces no results ==> getResultSet should be null"); -+ assertTrue(ps.getMoreResults(), "There are two statements => getMoreResults should be true"); - rs = ps.getResultSet(); -- Assert.assertNotNull("select produces results ==> getResultSet should be not null", rs); -- Assert.assertTrue("select produces 1 row ==> rs.next should be true", rs.next()); -- Assert.assertEquals("second result of query " + query, 42, rs.getInt(1)); -+ assertNotNull(rs, "select produces results ==> getResultSet should be not null"); -+ assertTrue(rs.next(), "select produces 1 row ==> rs.next should be true"); -+ assertEquals(42, rs.getInt(1), "second result of query " + query); - - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(ps); -@@ -729,7 +699,7 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - for (int i = 1; i < 5; i++) { -- assertTrue(rs.getBigDecimal(i).compareTo(values[i - 1]) == 0); -+ assertEquals(0, rs.getBigDecimal(i).compareTo(values[i - 1])); - } - rs.getDouble(5); - assertTrue(rs.wasNull()); -@@ -756,8 +726,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - double d = rs.getDouble(1); -- assertTrue(rs.getDouble(1) == 1.0E125); -- assertTrue(rs.getDouble(2) == 1.0E-130); -+ assertEquals(1.0E125, rs.getDouble(1)); -+ assertEquals(1.0E-130, rs.getDouble(2)); - rs.getDouble(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -783,8 +753,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - float f = rs.getFloat(1); -- assertTrue("expected 1.0E37,received " + rs.getFloat(1), rs.getFloat(1) == (float) 1.0E37); -- assertTrue("expected 1.0E-37,received " + rs.getFloat(2), rs.getFloat(2) == (float) 1.0E-37); -+ assertEquals((float) 1.0E37, rs.getFloat(1), "expected 1.0E37,received " + rs.getFloat(1)); -+ assertEquals((float) 1.0E-37, rs.getFloat(2), "expected 1.0E-37,received " + rs.getFloat(2)); - rs.getDouble(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -807,12 +777,12 @@ public class PreparedStatementTest extends BaseTest4 { - - private static void checkNaNLiterals(Statement stmt, ResultSet rs) throws SQLException { - rs.next(); -- assertTrue("Double.isNaN((Double) rs.getObject", Double.isNaN((Double) rs.getObject(3))); -- assertTrue("Double.isNaN(rs.getDouble", Double.isNaN(rs.getDouble(3))); -- assertTrue("Float.isNaN((Float) rs.getObject", Float.isNaN((Float) rs.getObject(2))); -- assertTrue("Float.isNaN(rs.getFloat", Float.isNaN(rs.getFloat(2))); -- assertTrue("Double.isNaN((Double) rs.getObject", Double.isNaN((Double) rs.getObject(1))); -- assertTrue("Double.isNaN(rs.getDouble", Double.isNaN(rs.getDouble(1))); -+ assertTrue(Double.isNaN((Double) rs.getObject(3)), "Double.isNaN((Double) rs.getObject"); -+ assertTrue(Double.isNaN(rs.getDouble(3)), "Double.isNaN(rs.getDouble"); -+ assertTrue(Float.isNaN((Float) rs.getObject(2)), "Float.isNaN((Float) rs.getObject"); -+ assertTrue(Float.isNaN(rs.getFloat(2)), "Float.isNaN(rs.getFloat"); -+ assertTrue(Double.isNaN((Double) rs.getObject(1)), "Double.isNaN((Double) rs.getObject"); -+ assertTrue(Double.isNaN(rs.getDouble(1)), "Double.isNaN(rs.getDouble"); - try { - rs.getBigDecimal(1); - fail("NaN::numeric rs.getBigDecimal"); -@@ -851,19 +821,19 @@ public class PreparedStatementTest extends BaseTest4 { - - private static void checkInfinityLiterals(ResultSet rs) throws SQLException { - rs.next(); -- assertEquals("inf numeric rs.getObject", Double.POSITIVE_INFINITY, rs.getObject(1)); -- assertEquals("inf numeric rs.getDouble", Double.POSITIVE_INFINITY, rs.getDouble(1), 0.0); -- assertEquals("inf real rs.getObject", Float.POSITIVE_INFINITY, rs.getObject(2)); -- assertEquals("inf real rs.getFloat", Float.POSITIVE_INFINITY, rs.getFloat(2), 0.0); -- assertEquals("inf double precision rs.getObject", Double.POSITIVE_INFINITY, rs.getObject(3)); -- assertEquals("inf double precision rs.getDouble", Double.POSITIVE_INFINITY, rs.getDouble(3), 0.0); -- -- assertEquals("-inf numeric rs.getObject", Double.NEGATIVE_INFINITY, rs.getObject(4)); -- assertEquals("-inf numeric rs.getDouble", Double.NEGATIVE_INFINITY, rs.getDouble(4), 0.0); -- assertEquals("-inf real rs.getObject", Float.NEGATIVE_INFINITY, rs.getObject(5)); -- assertEquals("-inf real rs.getFloat", Float.NEGATIVE_INFINITY, rs.getFloat(5), 0.0); -- assertEquals("-inf double precision rs.getObject", Double.NEGATIVE_INFINITY, rs.getObject(6)); -- assertEquals("-inf double precision rs.getDouble", Double.NEGATIVE_INFINITY, rs.getDouble(6), 0.0); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getObject(1), "inf numeric rs.getObject"); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getDouble(1), 0.0, "inf numeric rs.getDouble"); -+ assertEquals(Float.POSITIVE_INFINITY, rs.getObject(2), "inf real rs.getObject"); -+ assertEquals(Float.POSITIVE_INFINITY, rs.getFloat(2), 0.0, "inf real rs.getFloat"); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getObject(3), "inf double precision rs.getObject"); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getDouble(3), 0.0, "inf double precision rs.getDouble"); -+ -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getObject(4), "-inf numeric rs.getObject"); -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getDouble(4), 0.0, "-inf numeric rs.getDouble"); -+ assertEquals(Float.NEGATIVE_INFINITY, rs.getObject(5), "-inf real rs.getObject"); -+ assertEquals(Float.NEGATIVE_INFINITY, rs.getFloat(5), 0.0, "-inf real rs.getFloat"); -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getObject(6), "-inf double precision rs.getObject"); -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getDouble(6), 0.0, "-inf double precision rs.getDouble"); - - try { - rs.getBigDecimal(1); -@@ -912,18 +882,18 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = ps.executeQuery(); - rs.next(); - -- assertTrue("Float.isNaN((Float) rs.getObject", Float.isNaN((Float) rs.getObject(1))); -- assertTrue("Float.isNaN(rs.getFloat", Float.isNaN(rs.getFloat(1))); -- assertTrue("Double.isNaN((Double) rs.getObject", Double.isNaN((Double) rs.getObject(2))); -- assertTrue("Double.isNaN(rs.getDouble", Double.isNaN(rs.getDouble(2))); -- assertEquals("Float.POSITIVE_INFINITY rs.getObject", Float.POSITIVE_INFINITY, rs.getObject(3)); -- assertEquals("Float.POSITIVE_INFINITY rs.getFloat", Float.POSITIVE_INFINITY, rs.getFloat(3), 0); -- assertEquals("Double.POSITIVE_INFINITY rs.getObject", Double.POSITIVE_INFINITY, rs.getObject(4)); -- assertEquals("Double.POSITIVE_INFINITY rs.getDouble", Double.POSITIVE_INFINITY, rs.getDouble(4), 0); -- assertEquals("Float.NEGATIVE_INFINITY rs.getObject", Float.NEGATIVE_INFINITY, rs.getObject(5)); -- assertEquals("Float.NEGATIVE_INFINITY rs.getFloat", Float.NEGATIVE_INFINITY, rs.getFloat(5), 0); -- assertEquals("Double.NEGATIVE_INFINITY rs.getObject", Double.NEGATIVE_INFINITY, rs.getObject(6)); -- assertEquals("Double.NEGATIVE_INFINITY rs.getDouble", Double.NEGATIVE_INFINITY, rs.getDouble(6), 0); -+ assertTrue(Float.isNaN((Float) rs.getObject(1)), "Float.isNaN((Float) rs.getObject"); -+ assertTrue(Float.isNaN(rs.getFloat(1)), "Float.isNaN(rs.getFloat"); -+ assertTrue(Double.isNaN((Double) rs.getObject(2)), "Double.isNaN((Double) rs.getObject"); -+ assertTrue(Double.isNaN(rs.getDouble(2)), "Double.isNaN(rs.getDouble"); -+ assertEquals(Float.POSITIVE_INFINITY, rs.getObject(3), "Float.POSITIVE_INFINITY rs.getObject"); -+ assertEquals(Float.POSITIVE_INFINITY, rs.getFloat(3), 0, "Float.POSITIVE_INFINITY rs.getFloat"); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getObject(4), "Double.POSITIVE_INFINITY rs.getObject"); -+ assertEquals(Double.POSITIVE_INFINITY, rs.getDouble(4), 0, "Double.POSITIVE_INFINITY rs.getDouble"); -+ assertEquals(Float.NEGATIVE_INFINITY, rs.getObject(5), "Float.NEGATIVE_INFINITY rs.getObject"); -+ assertEquals(Float.NEGATIVE_INFINITY, rs.getFloat(5), 0, "Float.NEGATIVE_INFINITY rs.getFloat"); -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getObject(6), "Double.NEGATIVE_INFINITY rs.getObject"); -+ assertEquals(Double.NEGATIVE_INFINITY, rs.getDouble(6), 0, "Double.NEGATIVE_INFINITY rs.getDouble"); - - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(ps); -@@ -956,7 +926,7 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.setObject(7, "On", Types.BIT); - pstmt.setObject(8, '1', Types.BIT); - pstmt.setObject(8, "1", Types.BIT); -- assertEquals("one row inserted, true values", 1, pstmt.executeUpdate()); -+ assertEquals(1, pstmt.executeUpdate(), "one row inserted, true values"); - // Test FALSE values - pstmt.setBoolean(1, false); - pstmt.setObject(1, Boolean.FALSE); -@@ -972,7 +942,7 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.setObject(7, "Off", Types.BOOLEAN); - pstmt.setObject(8, "0", Types.BOOLEAN); - pstmt.setObject(8, '0', Types.BOOLEAN); -- assertEquals("one row inserted, false values", 1, pstmt.executeUpdate()); -+ assertEquals(1, pstmt.executeUpdate(), "one row inserted, false values"); - // Test weird values - pstmt.setObject(1, (byte) 0, Types.BOOLEAN); - pstmt.setObject(2, BigDecimal.ONE, Types.BOOLEAN); -@@ -991,26 +961,26 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - - assertTrue(rs.next()); -- assertTrue("expected true, received " + rs.getBoolean(1), rs.getBoolean(1)); -+ assertTrue(rs.getBoolean(1), "expected true, received " + rs.getBoolean(1)); - rs.getFloat(2); - assertTrue(rs.wasNull()); -- assertTrue("expected true, received " + rs.getBoolean(3), rs.getBoolean(3)); -- assertTrue("expected true, received " + rs.getBoolean(4), rs.getBoolean(4)); -- assertTrue("expected true, received " + rs.getBoolean(5), rs.getBoolean(5)); -- assertTrue("expected true, received " + rs.getBoolean(6), rs.getBoolean(6)); -- assertTrue("expected true, received " + rs.getBoolean(7), rs.getBoolean(7)); -- assertTrue("expected true, received " + rs.getBoolean(8), rs.getBoolean(8)); -+ assertTrue(rs.getBoolean(3), "expected true, received " + rs.getBoolean(3)); -+ assertTrue(rs.getBoolean(4), "expected true, received " + rs.getBoolean(4)); -+ assertTrue(rs.getBoolean(5), "expected true, received " + rs.getBoolean(5)); -+ assertTrue(rs.getBoolean(6), "expected true, received " + rs.getBoolean(6)); -+ assertTrue(rs.getBoolean(7), "expected true, received " + rs.getBoolean(7)); -+ assertTrue(rs.getBoolean(8), "expected true, received " + rs.getBoolean(8)); - - assertTrue(rs.next()); -- assertFalse("expected false, received " + rs.getBoolean(1), rs.getBoolean(1)); -+ assertFalse(rs.getBoolean(1), "expected false, received " + rs.getBoolean(1)); - rs.getBoolean(2); - assertTrue(rs.wasNull()); -- assertFalse("expected false, received " + rs.getBoolean(3), rs.getBoolean(3)); -- assertFalse("expected false, received " + rs.getBoolean(4), rs.getBoolean(4)); -- assertFalse("expected false, received " + rs.getBoolean(5), rs.getBoolean(5)); -- assertFalse("expected false, received " + rs.getBoolean(6), rs.getBoolean(6)); -- assertFalse("expected false, received " + rs.getBoolean(7), rs.getBoolean(7)); -- assertFalse("expected false, received " + rs.getBoolean(8), rs.getBoolean(8)); -+ assertFalse(rs.getBoolean(3), "expected false, received " + rs.getBoolean(3)); -+ assertFalse(rs.getBoolean(4), "expected false, received " + rs.getBoolean(4)); -+ assertFalse(rs.getBoolean(5), "expected false, received " + rs.getBoolean(5)); -+ assertFalse(rs.getBoolean(6), "expected false, received " + rs.getBoolean(6)); -+ assertFalse(rs.getBoolean(7), "expected false, received " + rs.getBoolean(7)); -+ assertFalse(rs.getBoolean(8), "expected false, received " + rs.getBoolean(8)); - - rs.close(); - pstmt.close(); -@@ -1027,14 +997,14 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.setObject(1, "this is not boolean", Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"this is not boolean\"", e.getMessage()); - } - try { - pstmt.setObject(1, 'X', Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"X\"", e.getMessage()); - } - try { -@@ -1042,63 +1012,63 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.setObject(1, obj, Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean", e.getMessage()); - } - try { - pstmt.setObject(1, "1.0", Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"1.0\"", e.getMessage()); - } - try { - pstmt.setObject(1, "-1", Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"-1\"", e.getMessage()); - } - try { - pstmt.setObject(1, "ok", Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"ok\"", e.getMessage()); - } - try { - pstmt.setObject(1, 0.99f, Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"0.99\"", e.getMessage()); - } - try { - pstmt.setObject(1, -0.01d, Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"-0.01\"", e.getMessage()); - } - try { - pstmt.setObject(1, new java.sql.Date(0), Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean", e.getMessage()); - } - try { - pstmt.setObject(1, new java.math.BigInteger("1000"), Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"1000\"", e.getMessage()); - } - try { - pstmt.setObject(1, Math.PI, Types.BOOLEAN); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"3.141592653589793\"", e.getMessage()); - } - pstmt.close(); -@@ -1128,10 +1098,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + maxFloat + " ,received " + rs.getObject(1), -- rs.getObject(1).equals(maxFloat)); -- assertTrue("expected " + minFloat + " ,received " + rs.getObject(2), -- rs.getObject(2).equals(minFloat)); -+ assertEquals(maxFloat, rs.getObject(1)); -+ assertEquals(minFloat, rs.getObject(2)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1166,16 +1134,16 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue(((Double) rs.getObject(1)).equals(maxFloat)); -- assertTrue(((Double) rs.getObject(2)).equals(minFloat)); -- assertTrue(rs.getDouble(1) == maxFloat); -- assertTrue(rs.getDouble(2) == minFloat); -+ assertEquals(maxFloat, ((Double) rs.getObject(1))); -+ assertEquals(minFloat, ((Double) rs.getObject(2))); -+ assertEquals(maxFloat, rs.getDouble(1)); -+ assertEquals(minFloat, rs.getDouble(2)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - - assertTrue(rs.next()); -- assertTrue("expected true, received " + rs.getBoolean(1), rs.getBoolean(1)); -- assertFalse("expected false,received " + rs.getBoolean(2), rs.getBoolean(2)); -+ assertTrue(rs.getBoolean(1)); -+ assertFalse(rs.getBoolean(2)); - - rs.close(); - pstmt.close(); -@@ -1205,10 +1173,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + maxFloat + " ,received " + rs.getObject(1), -- ((Double) rs.getObject(1)).equals(maxFloat)); -- assertTrue("expected " + minFloat + " ,received " + rs.getObject(2), -- ((Double) rs.getObject(2)).equals(minFloat)); -+ assertEquals(maxFloat, ((Double) rs.getObject(1))); -+ assertEquals(minFloat, ((Double) rs.getObject(2))); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1239,32 +1205,28 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertEquals("maxInt as rs.getObject", maxInt, rs.getObject(1)); -- assertEquals("minInt as rs.getObject", minInt, rs.getObject(2)); -+ assertEquals(maxInt, rs.getObject(1), "maxInt as rs.getObject"); -+ assertEquals(minInt, rs.getObject(2), "minInt as rs.getObject"); - rs.getObject(3); -- assertTrue("rs.wasNull after rs.getObject", rs.wasNull()); -- assertEquals("maxInt as rs.getInt", maxInt, (Integer) rs.getInt(1)); -- assertEquals("minInt as rs.getInt", minInt, (Integer) rs.getInt(2)); -+ assertTrue(rs.wasNull(), "rs.wasNull after rs.getObject"); -+ assertEquals(maxInt, (Integer) rs.getInt(1), "maxInt as rs.getInt"); -+ assertEquals(minInt, (Integer) rs.getInt(2), "minInt as rs.getInt"); - rs.getInt(3); -- assertTrue("rs.wasNull after rs.getInt", rs.wasNull()); -- assertEquals("maxInt as rs.getLong", Long.valueOf(maxInt), (Long) rs.getLong(1)); -- assertEquals("minInt as rs.getLong", Long.valueOf(minInt), (Long) rs.getLong(2)); -+ assertTrue(rs.wasNull(), "rs.wasNull after rs.getInt"); -+ assertEquals(Long.valueOf(maxInt), (Long) rs.getLong(1), "maxInt as rs.getLong"); -+ assertEquals(Long.valueOf(minInt), (Long) rs.getLong(2), "minInt as rs.getLong"); - rs.getLong(3); -- assertTrue("rs.wasNull after rs.getLong", rs.wasNull()); -- assertEquals("maxInt as rs.getBigDecimal", BigDecimal.valueOf(maxInt), rs.getBigDecimal(1)); -- assertEquals("minInt as rs.getBigDecimal", BigDecimal.valueOf(minInt), rs.getBigDecimal(2)); -- assertNull("rs.getBigDecimal", rs.getBigDecimal(3)); -- assertTrue("rs.getBigDecimal after rs.getLong", rs.wasNull()); -- assertEquals("maxInt as rs.getBigDecimal(scale=0)", BigDecimal.valueOf(maxInt), -- rs.getBigDecimal(1, 0)); -- assertEquals("minInt as rs.getBigDecimal(scale=0)", BigDecimal.valueOf(minInt), -- rs.getBigDecimal(2, 0)); -- assertNull("rs.getBigDecimal(scale=0)", rs.getBigDecimal(3, 0)); -- assertTrue("rs.getBigDecimal after rs.getLong", rs.wasNull()); -- assertEquals("maxInt as rs.getBigDecimal(scale=1)", -- BigDecimal.valueOf(maxInt).setScale(1, RoundingMode.HALF_EVEN), rs.getBigDecimal(1, 1)); -- assertEquals("minInt as rs.getBigDecimal(scale=1)", -- BigDecimal.valueOf(minInt).setScale(1, RoundingMode.HALF_EVEN), rs.getBigDecimal(2, 1)); -+ assertTrue(rs.wasNull(), "rs.wasNull after rs.getLong"); -+ assertEquals(BigDecimal.valueOf(maxInt), rs.getBigDecimal(1), "maxInt as rs.getBigDecimal"); -+ assertEquals(BigDecimal.valueOf(minInt), rs.getBigDecimal(2), "minInt as rs.getBigDecimal"); -+ assertNull(rs.getBigDecimal(3), "rs.getBigDecimal"); -+ assertTrue(rs.wasNull(), "rs.getBigDecimal after rs.getLong"); -+ assertEquals(BigDecimal.valueOf(maxInt), rs.getBigDecimal(1, 0), "maxInt as rs.getBigDecimal(scale=0)"); -+ assertEquals(BigDecimal.valueOf(minInt), rs.getBigDecimal(2, 0), "minInt as rs.getBigDecimal(scale=0)"); -+ assertNull(rs.getBigDecimal(3, 0), "rs.getBigDecimal(scale=0)"); -+ assertTrue(rs.wasNull(), "rs.getBigDecimal after rs.getLong"); -+ assertEquals(BigDecimal.valueOf(maxInt).setScale(1, RoundingMode.HALF_EVEN), rs.getBigDecimal(1, 1), "maxInt as rs.getBigDecimal(scale=1)"); -+ assertEquals(BigDecimal.valueOf(minInt).setScale(1, RoundingMode.HALF_EVEN), rs.getBigDecimal(2, 1), "minInt as rs.getBigDecimal(scale=1)"); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1295,10 +1257,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + maxInt + " ,received " + rs.getObject(1), -- rs.getObject(1).equals(maxInt)); -- assertTrue("expected " + minInt + " ,received " + rs.getObject(2), -- rs.getObject(2).equals(minInt)); -+ assertEquals(maxInt, rs.getObject(1)); -+ assertEquals(minInt, rs.getObject(2)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1328,10 +1288,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + maxInt + " ,received " + rs.getObject(1), -- ((Integer) rs.getObject(1)).equals(maxInt)); -- assertTrue("expected " + minInt + " ,received " + rs.getObject(2), -- ((Integer) rs.getObject(2)).equals(minInt)); -+ assertEquals(maxInt, ((Integer) rs.getObject(1))); -+ assertEquals(minInt, ((Integer) rs.getObject(2))); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1360,10 +1318,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + dBooleanTrue + " ,received " + rs.getObject(1), -- rs.getObject(1).equals(dBooleanTrue)); -- assertTrue("expected " + dBooleanFalse + " ,received " + rs.getObject(2), -- rs.getObject(2).equals(dBooleanFalse)); -+ assertEquals(dBooleanTrue, rs.getObject(1)); -+ assertEquals(dBooleanFalse, rs.getObject(2)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1392,10 +1348,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + dBooleanTrue + " ,received " + rs.getObject(1), -- ((BigDecimal) rs.getObject(1)).compareTo(dBooleanTrue) == 0); -- assertTrue("expected " + dBooleanFalse + " ,received " + rs.getObject(2), -- ((BigDecimal) rs.getObject(2)).compareTo(dBooleanFalse) == 0); -+ assertEquals(0, ((BigDecimal) rs.getObject(1)).compareTo(dBooleanTrue)); -+ assertEquals(0, ((BigDecimal) rs.getObject(2)).compareTo(dBooleanFalse)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1424,10 +1378,8 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - -- assertTrue("expected " + dBooleanTrue + " ,received " + rs.getObject(1), -- ((BigDecimal) rs.getObject(1)).compareTo(dBooleanTrue) == 0); -- assertTrue("expected " + dBooleanFalse + " ,received " + rs.getObject(2), -- ((BigDecimal) rs.getObject(2)).compareTo(dBooleanFalse) == 0); -+ assertEquals(0, ((BigDecimal) rs.getObject(1)).compareTo(dBooleanTrue)); -+ assertEquals(0, ((BigDecimal) rs.getObject(2)).compareTo(dBooleanFalse)); - rs.getFloat(3); - assertTrue(rs.wasNull()); - rs.close(); -@@ -1458,15 +1410,11 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt = con.prepareStatement("select n1,n2,n3,n4 from decimal_scale"); - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); -- assertTrue("expected numeric set via BigDecimal " + v + " stored as " + rs.getBigDecimal(1), -- v.compareTo(rs.getBigDecimal(1)) == 0); -- assertTrue("expected numeric set via String" + vs + " stored as " + rs.getBigDecimal(2), -- v.compareTo(rs.getBigDecimal(2)) == 0); -+ assertEquals(0, v.compareTo(rs.getBigDecimal(1)), "expected numeric set via BigDecimal " + v + " stored as " + rs.getBigDecimal(1)); -+ assertEquals(0, v.compareTo(rs.getBigDecimal(2)), "expected numeric set via String" + vs + " stored as " + rs.getBigDecimal(2)); - // float is really bad... -- assertTrue("expected numeric set via Float" + vf + " stored as " + rs.getBigDecimal(3), -- v.compareTo(rs.getBigDecimal(3).setScale(6, RoundingMode.HALF_UP)) == 0); -- assertTrue("expected numeric set via Double" + vd + " stored as " + rs.getBigDecimal(4), -- v.compareTo(rs.getBigDecimal(4)) == 0); -+ assertEquals(0, v.compareTo(rs.getBigDecimal(3).setScale(6, RoundingMode.HALF_UP)), "expected numeric set via Float" + vf + " stored as " + rs.getBigDecimal(3)); -+ assertEquals(0, v.compareTo(rs.getBigDecimal(4)), "expected numeric set via Double" + vd + " stored as " + rs.getBigDecimal(4)); - - rs.close(); - pstmt.close(); -@@ -1496,18 +1444,10 @@ public class PreparedStatementTest extends BaseTest4 { - ResultSet rs = psselect.executeQuery(); - assertTrue(rs.next()); - BigDecimal vscaled = v.setScale(s, RoundingMode.HALF_UP); -- assertTrue( -- "expected numeric set via BigDecimal " + v + " with scale " + s + " stored as " + vscaled, -- vscaled.compareTo(rs.getBigDecimal(1)) == 0); -- assertTrue( -- "expected numeric set via String" + vs + " with scale " + s + " stored as " + vscaled, -- vscaled.compareTo(rs.getBigDecimal(2)) == 0); -- assertTrue( -- "expected numeric set via Float" + vf + " with scale " + s + " stored as " + vscaled, -- vscaled.compareTo(rs.getBigDecimal(3)) == 0); -- assertTrue( -- "expected numeric set via Double" + vd + " with scale " + s + " stored as " + vscaled, -- vscaled.compareTo(rs.getBigDecimal(4)) == 0); -+ assertEquals(0, vscaled.compareTo(rs.getBigDecimal(1)), "expected numeric set via BigDecimal " + v + " with scale " + s + " stored as " + vscaled); -+ assertEquals(0, vscaled.compareTo(rs.getBigDecimal(2)), "expected numeric set via String" + vs + " with scale " + s + " stored as " + vscaled); -+ assertEquals(0, vscaled.compareTo(rs.getBigDecimal(3)), "expected numeric set via Float" + vf + " with scale " + s + " stored as " + vscaled); -+ assertEquals(0, vscaled.compareTo(rs.getBigDecimal(4)), "expected numeric set via Double" + vd + " with scale " + s + " stored as " + vscaled); - rs.close(); - pstruncate.executeUpdate(); - } -@@ -1529,9 +1469,7 @@ public class PreparedStatementTest extends BaseTest4 { - - ResultSet rs = psselect.executeQuery(); - assertTrue(rs.next()); -- assertTrue( -- "expected 733, but received " + rs.getBigDecimal(1), -- new BigDecimal("733").compareTo(rs.getBigDecimal(1)) == 0); -+ assertEquals(0, new BigDecimal("733").compareTo(rs.getBigDecimal(1)), "expected 733, but received " + rs.getBigDecimal(1)); - - psinsert.close(); - psselect.close(); -@@ -1549,9 +1487,7 @@ public class PreparedStatementTest extends BaseTest4 { - - ResultSet rs = psselect.executeQuery(); - assertTrue(rs.next()); -- assertTrue( -- "expected 733, but received " + rs.getBigDecimal(1), -- new BigDecimal("733").compareTo(rs.getBigDecimal(1)) == 0); -+ assertEquals(0, new BigDecimal("733").compareTo(rs.getBigDecimal(1)), "expected 733, but received " + rs.getBigDecimal(1)); - - psinsert.close(); - psselect.close(); -@@ -1569,9 +1505,7 @@ public class PreparedStatementTest extends BaseTest4 { - - ResultSet rs = psselect.executeQuery(); - assertTrue(rs.next()); -- assertTrue( -- "expected 733, but received " + rs.getBigDecimal(1), -- new BigDecimal("733").compareTo(rs.getBigDecimal(1)) == 0); -+ assertEquals(0, new BigDecimal("733").compareTo(rs.getBigDecimal(1)), "expected 733, but received " + rs.getBigDecimal(1)); - - psinsert.close(); - psselect.close(); -@@ -1584,8 +1518,7 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.setString(1, "1 week"); - try { - pstmt.executeUpdate(); -- assertTrue("When using extended protocol, interval vs character varying type mismatch error is expected", -- preferQueryMode == PreferQueryMode.SIMPLE); -+ assertSame(PreferQueryMode.SIMPLE, preferQueryMode, "When using extended protocol, interval vs character varying type mismatch error is expected"); - } catch (SQLException sqle) { - // ERROR: column "i" is of type interval but expression is of type character varying - } -@@ -1627,8 +1560,7 @@ public class PreparedStatementTest extends BaseTest4 { - @Test - public void testBatchWithPrepareThreshold5() throws SQLException { - assumeBinaryModeRegular(); -- Assume.assumeTrue("simple protocol only does not support prepared statement requests", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "simple protocol only does not support prepared statement requests"); - - PreparedStatement pstmt = con.prepareStatement("CREATE temp TABLE batch_tab_threshold5 (id bigint, val bigint)"); - pstmt.executeUpdate(); -@@ -1646,19 +1578,15 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.executeBatch(); - } - pstmt.close(); -- Assume.assumeFalse("Test assertions below support only non-rewritten insert statements", -- con.unwrap(PgConnection.class).getQueryExecutor().isReWriteBatchedInsertsEnabled()); -- assertTrue("prepareThreshold=5, so the statement should be server-prepared", -- ((PGStatement) pstmt).isUseServerPrepare()); -- assertEquals("prepareThreshold=5, so the statement should be server-prepared", 1, -- getNumberOfServerPreparedStatements("INSERT INTO batch_tab_threshold5 (id, val) VALUES ($1,$2)")); -+ assumeFalse(con.unwrap(PgConnection.class).getQueryExecutor().isReWriteBatchedInsertsEnabled(), "Test assertions below support only non-rewritten insert statements"); -+ assertTrue(((PGStatement) pstmt).isUseServerPrepare(), "prepareThreshold=5, so the statement should be server-prepared"); -+ assertEquals(1, getNumberOfServerPreparedStatements("INSERT INTO batch_tab_threshold5 (id, val) VALUES ($1,$2)"), "prepareThreshold=5, so the statement should be server-prepared"); - } - - @Test - public void testBatchWithPrepareThreshold0() throws SQLException { - assumeBinaryModeRegular(); -- Assume.assumeTrue("simple protocol only does not support prepared statement requests", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "simple protocol only does not support prepared statement requests"); - - PreparedStatement pstmt = con.prepareStatement("CREATE temp TABLE batch_tab_threshold0 (id bigint, val bigint)"); - pstmt.executeUpdate(); -@@ -1677,17 +1605,14 @@ public class PreparedStatementTest extends BaseTest4 { - } - pstmt.close(); - -- assertFalse("prepareThreshold=0, so the statement should not be server-prepared", -- ((PGStatement) pstmt).isUseServerPrepare()); -- assertEquals("prepareThreshold=0, so the statement should not be server-prepared", 0, -- getNumberOfServerPreparedStatements("INSERT INTO batch_tab_threshold0 (id, val) VALUES ($1,$2)")); -+ assertFalse(((PGStatement) pstmt).isUseServerPrepare(), "prepareThreshold=0, so the statement should not be server-prepared"); -+ assertEquals(0, getNumberOfServerPreparedStatements("INSERT INTO batch_tab_threshold0 (id, val) VALUES ($1,$2)"), "prepareThreshold=0, so the statement should not be server-prepared"); - } - - @Test - public void testSelectPrepareThreshold0AutoCommitFalseFetchSizeNonZero() throws SQLException { - assumeBinaryModeRegular(); -- Assume.assumeTrue("simple protocol only does not support prepared statement requests", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "simple protocol only does not support prepared statement requests"); - - con.setAutoCommit(false); - PreparedStatement pstmt = null; -@@ -1704,11 +1629,9 @@ public class PreparedStatementTest extends BaseTest4 { - TestUtil.closeQuietly(pstmt); - } - -- assertFalse("prepareThreshold=0, so the statement should not be server-prepared", -- ((PGStatement) pstmt).isUseServerPrepare()); -+ assertFalse(((PGStatement) pstmt).isUseServerPrepare(), "prepareThreshold=0, so the statement should not be server-prepared"); - -- assertEquals("prepareThreshold=0, so the statement should not be server-prepared", 0, -- getNumberOfServerPreparedStatements("SELECT 42")); -+ assertEquals(0, getNumberOfServerPreparedStatements("SELECT 42"), "prepareThreshold=0, so the statement should not be server-prepared"); - } - - @Test -@@ -1729,8 +1652,7 @@ public class PreparedStatementTest extends BaseTest4 { - "date", ps); - try { - assertTrue(rs.next()); -- assertNull("NULL DATE converted to TIMESTAMP should return NULL value on getObject", -- rs.getObject(1)); -+ assertNull(rs.getObject(1), "NULL DATE converted to TIMESTAMP should return NULL value on getObject"); - } finally { - rs.close(); - } -@@ -1743,9 +1665,7 @@ public class PreparedStatementTest extends BaseTest4 { - "timestamp", ps); - try { - assertTrue(rs.next()); -- assertEquals( -- "Looks like we got a narrowing of the data (TIMESTAMP -> DATE). It might caused by inappropriate caching of the statement.", -- ts, rs.getObject(1)); -+ assertEquals(ts, rs.getObject(1), "Looks like we got a narrowing of the data (TIMESTAMP -> DATE). It might caused by inappropriate caching of the statement."); - } finally { - rs.close(); - } -@@ -1760,8 +1680,7 @@ public class PreparedStatementTest extends BaseTest4 { - return; - } - ParameterMetaData pmd = ps.getParameterMetaData(); -- assertEquals("getParameterMetaData().getParameterTypeName(1) " + msg, -- expected, pmd.getParameterTypeName(1)); -+ assertEquals(expected, pmd.getParameterTypeName(1), () -> "getParameterMetaData().getParameterTypeName(1) " + msg); - } - - @Test -@@ -1796,25 +1715,23 @@ public class PreparedStatementTest extends BaseTest4 { - ps.setString(1, "42"); - rs = ps.executeQuery(); - rs.next(); -- Assert.assertEquals("setString(1, \"42\") -> \"42\" expected", "42", rs.getObject(1)); -+ assertEquals("42", rs.getObject(1), "setString(1, \"42\") -> \"42\" expected"); - rs.close(); - - // The bind type is flipped from VARCHAR to INTEGER, and it causes the driver to prepare statement again - ps.setNull(1, Types.INTEGER); - rs = ps.executeQuery(); - rs.next(); -- Assert.assertNull("setNull(1, Types.INTEGER) -> null expected", rs.getObject(1)); -- Assert.assertEquals("A re-parse was expected, so the number of parses should be 1", -- 1, numOfReParses.get()); -+ assertNull(rs.getObject(1), "setNull(1, Types.INTEGER) -> null expected"); -+ assertEquals(1, numOfReParses.get(), "A re-parse was expected, so the number of parses should be 1"); - rs.close(); - - // The bind type is flipped from INTEGER to VARCHAR, and it causes the driver to prepare statement again - ps.setString(1, "42"); - rs = ps.executeQuery(); - rs.next(); -- Assert.assertEquals("setString(1, \"42\") -> \"42\" expected", "42", rs.getObject(1)); -- Assert.assertEquals("One more re-parse is expected, so the number of parses should be 2", -- 2, numOfReParses.get()); -+ assertEquals("42", rs.getObject(1), "setString(1, \"42\") -> \"42\" expected"); -+ assertEquals(2, numOfReParses.get(), "One more re-parse is expected, so the number of parses should be 2"); - rs.close(); - - // Types.OTHER null is sent as UNSPECIFIED, and pgjdbc does not re-parse on UNSPECIFIED nulls -@@ -1822,17 +1739,15 @@ public class PreparedStatementTest extends BaseTest4 { - ps.setNull(1, Types.OTHER); - rs = ps.executeQuery(); - rs.next(); -- Assert.assertNull("setNull(1, Types.OTHER) -> null expected", rs.getObject(1)); -- Assert.assertEquals("setNull(, Types.OTHER) should not cause re-parse", -- 2, numOfReParses.get()); -+ assertNull(rs.getObject(1), "setNull(1, Types.OTHER) -> null expected"); -+ assertEquals(2, numOfReParses.get(), "setNull(, Types.OTHER) should not cause re-parse"); - - // Types.INTEGER null is sent as int4 null, and it leads to re-parse - ps.setNull(1, Types.INTEGER); - rs = ps.executeQuery(); - rs.next(); -- Assert.assertNull("setNull(1, Types.INTEGER) -> null expected", rs.getObject(1)); -- Assert.assertEquals("setNull(, Types.INTEGER) causes re-parse", -- 3, numOfReParses.get()); -+ assertNull(rs.getObject(1), "setNull(1, Types.INTEGER) -> null expected"); -+ assertEquals(3, numOfReParses.get(), "setNull(, Types.INTEGER) causes re-parse"); - rs.close(); - } finally { - TestUtil.closeQuietly(ps); -diff --git a/src/test/java/org/postgresql/test/jdbc2/QuotationTest.java b/src/test/java/org/postgresql/test/jdbc2/QuotationTest.java -index 84637af..4cd081e 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/QuotationTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/QuotationTest.java -@@ -5,14 +5,14 @@ - - package org.postgresql.test.jdbc2; - --import org.postgresql.test.SlowTests; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ - import org.postgresql.test.TestUtil; -+import org.postgresql.test.annotations.tags.Slow; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.experimental.categories.Category; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -20,7 +20,8 @@ import java.sql.SQLException; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "{index}: quotes(style={0}, src={1}, quoted={2})") -+@MethodSource("data") - public class QuotationTest extends BaseTest4 { - private enum QuoteStyle { - SIMPLE("'"), DOLLAR_NOTAG("$$"), DOLLAR_A("$a$"), DOLLAR_DEF("$DEF$"), -@@ -47,7 +48,6 @@ public class QuotationTest extends BaseTest4 { - this.expr = expr; - } - -- @Parameterized.Parameters(name = "{index}: quotes(style={0}, src={1}, quoted={2})") - public static Iterable data() { - Collection prefix = new ArrayList<>(); - // Too many prefixes make test run long -@@ -114,21 +114,21 @@ public class QuotationTest extends BaseTest4 { - } - - @Test -- @Category(SlowTests.class) -+ @Slow - public void quotedString() throws SQLException { - PreparedStatement ps = con.prepareStatement("select " + expr); - try { - ResultSet rs = ps.executeQuery(); - rs.next(); - String val = rs.getString(1); -- Assert.assertEquals(expected, val); -+ assertEquals(expected, val); - } catch (SQLException e) { - TestUtil.closeQuietly(ps); - } - } - - @Test -- @Category(SlowTests.class) -+ @Slow - public void bindInTheMiddle() throws SQLException { - PreparedStatement ps = con.prepareStatement("select " + expr + ", ?, " + expr); - try { -@@ -137,8 +137,8 @@ public class QuotationTest extends BaseTest4 { - rs.next(); - String val1 = rs.getString(1); - String val3 = rs.getString(3); -- Assert.assertEquals(expected, val1); -- Assert.assertEquals(expected, val3); -+ assertEquals(expected, val1); -+ assertEquals(expected, val3); - } catch (SQLException e) { - TestUtil.closeQuietly(ps); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/RefCursorFetchTest.java b/src/test/java/org/postgresql/test/jdbc2/RefCursorFetchTest.java -index 41f58c0..f0b5c3f 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/RefCursorFetchTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/RefCursorFetchTest.java -@@ -5,18 +5,18 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - - // import org.checkerframework.checker.nullness.qual.Nullable; --import org.junit.AfterClass; --import org.junit.BeforeClass; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.AfterAll; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.CallableStatement; - import java.sql.Connection; -@@ -27,7 +27,8 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, numRows = {1}, defaultFetchSize = {2}, statementFetchSize = {3}, resultSetFetchSize = {4}, autoCommit = {5}, commitAfterExecute = {6}") -+@MethodSource("data") - public class RefCursorFetchTest extends BaseTest4 { - private final int numRows; - private final /* @Nullable */ Integer defaultFetchSize; -@@ -50,7 +51,6 @@ public class RefCursorFetchTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}, numRows = {1}, defaultFetchSize = {2}, statementFetchSize = {3}, resultSetFetchSize = {4}, autoCommit = {5}, commitAfterExecute = {6}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -79,7 +79,7 @@ public class RefCursorFetchTest extends BaseTest4 { - } - } - -- @BeforeClass -+ @BeforeAll - public static void beforeClass() throws Exception { - TestUtil.assumeHaveMinimumServerVersion(ServerVersion.v9_0); - try (Connection con = TestUtil.openDB()) { -@@ -101,7 +101,7 @@ public class RefCursorFetchTest extends BaseTest4 { - } - } - -- @AfterClass -+ @AfterAll - public static void afterClass() throws Exception { - try (Connection con = TestUtil.openDB()) { - TestUtil.dropTable(con, "test_blob"); -@@ -141,7 +141,7 @@ public class RefCursorFetchTest extends BaseTest4 { - while (rs.next()) { - cnt++; - } -- assertEquals("number of rows from test_blob(...) call", numRows, cnt); -+ assertEquals(numRows, cnt, "number of rows from test_blob(...) call"); - } catch (SQLException e) { - if (commitAfterExecute && "34000".equals(e.getSQLState())) { - // Transaction commit closes refcursor, so the fetch call is expected to fail -@@ -152,12 +152,11 @@ public class RefCursorFetchTest extends BaseTest4 { - int expectedRows = - fetchSize != null && fetchSize != 0 ? Math.min(fetchSize, numRows) : numRows; - assertEquals( -- "The transaction was committed before processing the results," -- + " so expecting ResultSet to buffer fetchSize=" + fetchSize + " rows out of " -- + numRows, - expectedRows, -- cnt -- ); -+ cnt, -+ () -> "The transaction was committed before processing the results," -+ + " so expecting ResultSet to buffer fetchSize=" + fetchSize + " rows out of " -+ + numRows); - return; - } - throw e; -diff --git a/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java b/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java -index 2358c57..e6e4d0f 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java -@@ -5,17 +5,17 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.test.TestUtil; - --import org.junit.BeforeClass; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.CallableStatement; - import java.sql.Connection; -@@ -34,7 +34,8 @@ import java.util.Arrays; - * - * @author Nic Ferrier (nferrier@tapsellferrier.co.uk) - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "typeName = {0}, cursorType = {1}") -+@MethodSource("data") - public class RefCursorTest extends BaseTest4 { - - private final int cursorType; -@@ -43,7 +44,6 @@ public class RefCursorTest extends BaseTest4 { - this.cursorType = cursorType; - } - -- @Parameterized.Parameters(name = "typeName = {0}, cursorType = {1}") - public static Iterable data() { - return Arrays.asList(new Object[][]{ - {"OTHER", Types.OTHER}, -@@ -51,7 +51,7 @@ public class RefCursorTest extends BaseTest4 { - }); - } - -- @BeforeClass -+ @BeforeAll - public static void beforeClass() throws Exception { - try (Connection con = TestUtil.openDB()) { - assumeCallableStatementsSupported(con); -@@ -132,7 +132,7 @@ public class RefCursorTest extends BaseTest4 { - call.execute(); - - ResultSet rs = (ResultSet) call.getObject(1); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - rs.close(); - - call.close(); -@@ -163,8 +163,8 @@ public class RefCursorTest extends BaseTest4 { - call.execute(); - ResultSet rs = (ResultSet) call.getObject(1); - -- assertEquals(rs.getType(), ResultSet.TYPE_SCROLL_INSENSITIVE); -- assertEquals(rs.getConcurrency(), ResultSet.CONCUR_READ_ONLY); -+ assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType()); -+ assertEquals(ResultSet.CONCUR_READ_ONLY, rs.getConcurrency()); - - assertTrue(rs.last()); - assertEquals(6, rs.getRow()); -diff --git a/src/test/java/org/postgresql/test/jdbc2/ReplaceProcessingTest.java b/src/test/java/org/postgresql/test/jdbc2/ReplaceProcessingTest.java -index 506f0a5..76fbee3 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ReplaceProcessingTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ReplaceProcessingTest.java -@@ -5,23 +5,25 @@ - - package org.postgresql.test.jdbc2; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.Parameter; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.SQLException; - import java.util.Arrays; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "input={0}, expected={1}") -+@MethodSource("data") - public class ReplaceProcessingTest extends BaseTest4 { - -- @Parameterized.Parameter(0) -+ @Parameter(0) - public String input; -- @Parameterized.Parameter(1) -+ @Parameter(1) - public String expected; - -- @Parameterized.Parameters(name = "input={0}, expected={1}") - public static Iterable data() { - return Arrays.asList(new Object[][]{ - {"{fn timestampadd(SQL_TSI_YEAR, ?, {fn now()})}", "(CAST( $1||' year' as interval)+ now())"}, -@@ -41,6 +43,6 @@ public class ReplaceProcessingTest extends BaseTest4 { - - @Test - public void run() throws SQLException { -- Assert.assertEquals(input, expected, con.nativeSQL(input)); -+ assertEquals(expected, con.nativeSQL(input), input); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/ResultSetMetaDataTest.java b/src/test/java/org/postgresql/test/jdbc2/ResultSetMetaDataTest.java -index 7896faf..953d766 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ResultSetMetaDataTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ResultSetMetaDataTest.java -@@ -5,9 +5,11 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGProperty; - import org.postgresql.PGResultSetMetaData; -@@ -15,11 +17,9 @@ import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Connection; - import java.sql.DatabaseMetaData; -@@ -33,7 +33,8 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "databaseMetadataCacheFields = {0}, databaseMetadataCacheFieldsMib = {1}") -+@MethodSource("data") - public class ResultSetMetaDataTest extends BaseTest4 { - Connection conn; - private final Integer databaseMetadataCacheFields; -@@ -44,7 +45,6 @@ public class ResultSetMetaDataTest extends BaseTest4 { - this.databaseMetadataCacheFieldsMib = databaseMetadataCacheFieldsMib; - } - -- @Parameterized.Parameters(name = "databaseMetadataCacheFields = {0}, databaseMetadataCacheFieldsMib = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (Integer fields : new Integer[]{null, 0}) { -@@ -240,7 +240,7 @@ public class ResultSetMetaDataTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery("SELECT c,b,a FROM serialtest"); - ResultSetMetaData rsmd = rs.getMetaData(); - -- assertTrue(!rsmd.isAutoIncrement(1)); -+ assertFalse(rsmd.isAutoIncrement(1)); - assertTrue(rsmd.isAutoIncrement(2)); - assertTrue(rsmd.isAutoIncrement(3)); - assertEquals("bigserial", rsmd.getColumnTypeName(2)); -@@ -301,7 +301,7 @@ public class ResultSetMetaDataTest extends BaseTest4 { - PreparedStatement pstmt = conn.prepareStatement("SELECT id FROM identitytest"); - ResultSet rs = pstmt.executeQuery(); - ResultSetMetaData rsmd = pstmt.getMetaData(); -- Assert.assertTrue(rsmd.isAutoIncrement(1)); -+ assertTrue(rsmd.isAutoIncrement(1)); - } - - // Verifies that the field metadatacache will cache when enabled and also functions properly -@@ -336,13 +336,12 @@ public class ResultSetMetaDataTest extends BaseTest4 { - } - - private void assumePreparedStatementMetadataSupported() { -- Assume.assumeTrue("prepared statement metadata is not supported for simple protocol", -- preferQueryMode.compareTo(PreferQueryMode.EXTENDED_FOR_PREPARED) >= 0); -+ assumeTrue(preferQueryMode.compareTo(PreferQueryMode.EXTENDED_FOR_PREPARED) >= 0, "prepared statement metadata is not supported for simple protocol"); - } - - @Test - public void testSmallSerialColumns() throws SQLException { -- org.junit.Assume.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_2)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_2)); - TestUtil.createTable(con, "smallserial_test", "a smallserial"); - - Statement stmt = conn.createStatement(); -diff --git a/src/test/java/org/postgresql/test/jdbc2/ResultSetRefreshTest.java b/src/test/java/org/postgresql/test/jdbc2/ResultSetRefreshTest.java -index 023f271..23cb820 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ResultSetRefreshTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ResultSetRefreshTest.java -@@ -5,11 +5,11 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.test.TestUtil; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.ResultSet; - import java.sql.SQLException; -diff --git a/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java b/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java -index d75cdc6..e6d6730 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java -@@ -5,13 +5,15 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertSame; --import static org.junit.Assert.assertThrows; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertSame; -+import static org.junit.jupiter.api.Assertions.assertThrows; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.core.ServerVersion; -@@ -19,10 +21,11 @@ import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PGobject; - import org.postgresql.util.PSQLException; -+import org.postgresql.util.PSQLState; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.lang.reflect.Field; - import java.math.BigDecimal; -@@ -44,17 +47,17 @@ import java.util.concurrent.Future; - import java.util.concurrent.TimeUnit; - import java.util.concurrent.TimeoutException; - --/* -+/** - * ResultSet tests. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class ResultSetTest extends BaseTest4 { - - public ResultSetTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -216,7 +219,7 @@ public class ResultSetTest extends BaseTest4 { - con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = stmt.executeQuery("SELECT * FROM testrs"); - -- assertTrue(!rs.absolute(0)); -+ assertFalse(rs.absolute(0)); - assertEquals(0, rs.getRow()); - - assertTrue(rs.absolute(-1)); -@@ -225,12 +228,12 @@ public class ResultSetTest extends BaseTest4 { - assertTrue(rs.absolute(1)); - assertEquals(1, rs.getRow()); - -- assertTrue(!rs.absolute(-10)); -+ assertFalse(rs.absolute(-10)); - assertEquals(0, rs.getRow()); - assertTrue(rs.next()); - assertEquals(1, rs.getRow()); - -- assertTrue(!rs.absolute(10)); -+ assertFalse(rs.absolute(10)); - assertEquals(0, rs.getRow()); - assertTrue(rs.previous()); - assertEquals(6, rs.getRow()); -@@ -244,7 +247,7 @@ public class ResultSetTest extends BaseTest4 { - con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = stmt.executeQuery("SELECT * FROM testrs"); - -- assertTrue(!rs.relative(0)); -+ assertFalse(rs.relative(0)); - assertEquals(0, rs.getRow()); - assertTrue(rs.isBeforeFirst()); - -@@ -257,7 +260,7 @@ public class ResultSetTest extends BaseTest4 { - assertTrue(rs.relative(0)); - assertEquals(3, rs.getRow()); - -- assertTrue(!rs.relative(-3)); -+ assertFalse(rs.relative(-3)); - assertEquals(0, rs.getRow()); - assertTrue(rs.isBeforeFirst()); - -@@ -267,14 +270,14 @@ public class ResultSetTest extends BaseTest4 { - assertTrue(rs.relative(-1)); - assertEquals(3, rs.getRow()); - -- assertTrue(!rs.relative(6)); -+ assertFalse(rs.relative(6)); - assertEquals(0, rs.getRow()); - assertTrue(rs.isAfterLast()); - - assertTrue(rs.relative(-4)); - assertEquals(3, rs.getRow()); - -- assertTrue(!rs.relative(-6)); -+ assertFalse(rs.relative(-6)); - assertEquals(0, rs.getRow()); - assertTrue(rs.isBeforeFirst()); - -@@ -288,9 +291,9 @@ public class ResultSetTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery("SELECT * FROM testrs where id=100"); - rs.beforeFirst(); - rs.afterLast(); -- assertTrue(!rs.first()); -- assertTrue(!rs.last()); -- assertTrue(!rs.next()); -+ assertFalse(rs.first()); -+ assertFalse(rs.last()); -+ assertFalse(rs.next()); - } - - @Test -@@ -362,7 +365,7 @@ public class ResultSetTest extends BaseTest4 { - rs.getBoolean(1); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - } - } - } -@@ -392,15 +395,15 @@ public class ResultSetTest extends BaseTest4 { - Statement stmt = con.createStatement(); - ResultSet rs = stmt.executeQuery("select 1::" + dataType + ", 0::" + dataType + ", 2::" + dataType); - assertTrue(rs.next()); -- assertEquals(true, rs.getBoolean(1)); -- assertEquals(false, rs.getBoolean(2)); -+ assertTrue(rs.getBoolean(1)); -+ assertFalse(rs.getBoolean(2)); - - try { - // The JDBC ResultSet JavaDoc states that only 1 and 0 are valid values, so 2 should return error. - rs.getBoolean(3); - fail(); - } catch (SQLException e) { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - // message can be 2 or 2.0 depending on whether binary or text - final String message = e.getMessage(); - if (!"Cannot cast to boolean: \"2.0\"".equals(message)) { -@@ -444,7 +447,7 @@ public class ResultSetTest extends BaseTest4 { - fail(message); - } - } else { -- assertEquals(org.postgresql.util.PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); -+ assertEquals(PSQLState.CANNOT_COERCE.getState(), e.getSQLState()); - assertEquals("Cannot cast to boolean: \"" + value + "\"", e.getMessage()); - } - } -@@ -940,9 +943,7 @@ public class ResultSetTest extends BaseTest4 { - assertEquals(ResultSet.CONCUR_UPDATABLE, rs.getConcurrency()); - assertEquals(ResultSet.TYPE_SCROLL_SENSITIVE, rs.getType()); - if (!con.unwrap(PGConnection.class).getAdaptiveFetch()) { -- assertEquals("ResultSet.fetchSize should not change after query execution", -- 100, -- rs.getFetchSize()); -+ assertEquals(100, rs.getFetchSize(), "ResultSet.fetchSize should not change after query execution"); - } - assertEquals(ResultSet.FETCH_UNKNOWN, rs.getFetchDirection()); - -@@ -1001,23 +1002,23 @@ public class ResultSetTest extends BaseTest4 { - con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = - stmt.executeQuery("SELECT * FROM pg_database WHERE datname='nonexistentdatabase'"); -- assertTrue(!rs.previous()); -- assertTrue(!rs.previous()); -- assertTrue(!rs.next()); -- assertTrue(!rs.next()); -- assertTrue(!rs.next()); -- assertTrue(!rs.next()); -- assertTrue(!rs.next()); -- assertTrue(!rs.previous()); -- assertTrue(!rs.first()); -- assertTrue(!rs.last()); -+ assertFalse(rs.previous()); -+ assertFalse(rs.previous()); -+ assertFalse(rs.next()); -+ assertFalse(rs.next()); -+ assertFalse(rs.next()); -+ assertFalse(rs.next()); -+ assertFalse(rs.next()); -+ assertFalse(rs.previous()); -+ assertFalse(rs.first()); -+ assertFalse(rs.last()); - assertEquals(0, rs.getRow()); -- assertTrue(!rs.absolute(1)); -- assertTrue(!rs.relative(1)); -- assertTrue(!rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -- assertTrue(!rs.isFirst()); -- assertTrue(!rs.isLast()); -+ assertFalse(rs.absolute(1)); -+ assertFalse(rs.relative(1)); -+ assertFalse(rs.isBeforeFirst()); -+ assertFalse(rs.isAfterLast()); -+ assertFalse(rs.isFirst()); -+ assertFalse(rs.isLast()); - rs.close(); - stmt.close(); - } -@@ -1030,51 +1031,51 @@ public class ResultSetTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery("SELECT * FROM pg_database WHERE datname='template1'"); - - assertTrue(rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -- assertTrue(!rs.isFirst()); -- assertTrue(!rs.isLast()); -+ assertFalse(rs.isAfterLast()); -+ assertFalse(rs.isFirst()); -+ assertFalse(rs.isLast()); - - assertTrue(rs.next()); - -- assertTrue(!rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -+ assertFalse(rs.isBeforeFirst()); -+ assertFalse(rs.isAfterLast()); - assertTrue(rs.isFirst()); - assertTrue(rs.isLast()); - -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - -- assertTrue(!rs.isBeforeFirst()); -+ assertFalse(rs.isBeforeFirst()); - assertTrue(rs.isAfterLast()); -- assertTrue(!rs.isFirst()); -- assertTrue(!rs.isLast()); -+ assertFalse(rs.isFirst()); -+ assertFalse(rs.isLast()); - - assertTrue(rs.previous()); - -- assertTrue(!rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -+ assertFalse(rs.isBeforeFirst()); -+ assertFalse(rs.isAfterLast()); - assertTrue(rs.isFirst()); - assertTrue(rs.isLast()); - - assertTrue(rs.absolute(1)); - -- assertTrue(!rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -+ assertFalse(rs.isBeforeFirst()); -+ assertFalse(rs.isAfterLast()); - assertTrue(rs.isFirst()); - assertTrue(rs.isLast()); - -- assertTrue(!rs.absolute(0)); -+ assertFalse(rs.absolute(0)); - - assertTrue(rs.isBeforeFirst()); -- assertTrue(!rs.isAfterLast()); -- assertTrue(!rs.isFirst()); -- assertTrue(!rs.isLast()); -+ assertFalse(rs.isAfterLast()); -+ assertFalse(rs.isFirst()); -+ assertFalse(rs.isLast()); - -- assertTrue(!rs.absolute(2)); -+ assertFalse(rs.absolute(2)); - -- assertTrue(!rs.isBeforeFirst()); -+ assertFalse(rs.isBeforeFirst()); - assertTrue(rs.isAfterLast()); -- assertTrue(!rs.isFirst()); -- assertTrue(!rs.isLast()); -+ assertFalse(rs.isFirst()); -+ assertFalse(rs.isLast()); - - rs.close(); - stmt.close(); -@@ -1094,8 +1095,7 @@ public class ResultSetTest extends BaseTest4 { - } - try { - rs.afterLast(); -- fail( -- "afterLast() on a TYPE_FORWARD_ONLY resultset did not throw an exception on a TYPE_FORWARD_ONLY resultset"); -+ fail("afterLast() on a TYPE_FORWARD_ONLY resultset did not throw an exception on a TYPE_FORWARD_ONLY resultset"); - } catch (SQLException e) { - } - try { -@@ -1126,15 +1126,13 @@ public class ResultSetTest extends BaseTest4 { - - try { - rs.setFetchDirection(ResultSet.FETCH_REVERSE); -- fail( -- "setFetchDirection(FETCH_REVERSE) on a TYPE_FORWARD_ONLY resultset did not throw an exception"); -+ fail("setFetchDirection(FETCH_REVERSE) on a TYPE_FORWARD_ONLY resultset did not throw an exception"); - } catch (SQLException e) { - } - - try { - rs.setFetchDirection(ResultSet.FETCH_UNKNOWN); -- fail( -- "setFetchDirection(FETCH_UNKNOWN) on a TYPE_FORWARD_ONLY resultset did not throw an exception"); -+ fail("setFetchDirection(FETCH_UNKNOWN) on a TYPE_FORWARD_ONLY resultset did not throw an exception"); - } catch (SQLException e) { - } - -@@ -1308,10 +1306,10 @@ public class ResultSetTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery("select * from testrs"); - Map columnNameIndexMap; - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - assertTrue(rs.next()); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - rs.getInt("ID"); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); - assertNotNull(columnNameIndexMap); -@@ -1320,7 +1318,7 @@ public class ResultSetTest extends BaseTest4 { - rs.close(); - rs = stmt.executeQuery("select * from testrs"); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - assertTrue(rs.next()); - rs.getInt("Id"); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -@@ -1338,10 +1336,10 @@ public class ResultSetTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - Map columnNameIndexMap; - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - assertTrue(rs.next()); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - rs.getInt("id"); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); - assertNotNull(columnNameIndexMap); -@@ -1349,7 +1347,7 @@ public class ResultSetTest extends BaseTest4 { - rs = pstmt.executeQuery(); - assertTrue(rs.next()); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); -- assertEquals(null, columnNameIndexMap); -+ assertNull(columnNameIndexMap); - rs.getInt("id"); - columnNameIndexMap = getResultSetColumnNameIndexMap(rs); - assertNotNull(columnNameIndexMap); -@@ -1363,8 +1361,7 @@ public class ResultSetTest extends BaseTest4 { - */ - @Test - public void testNamedPreparedStatementResultSetColumnMappingCache() throws SQLException { -- assumeTrue("Simple protocol only mode does not support server-prepared statements", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "Simple protocol only mode does not support server-prepared statements"); - PreparedStatement pstmt = con.prepareStatement("SELECT id FROM testrs"); - ResultSet rs; - // Make sure the prepared statement is named. -@@ -1383,9 +1380,7 @@ public class ResultSetTest extends BaseTest4 { - rs = pstmt.executeQuery(); - assertTrue(rs.next()); - rs.getInt("id"); -- assertSame( -- "Cached mapping should be same between different result sets of same named prepared statement", -- columnNameIndexMap, getResultSetColumnNameIndexMap(rs)); -+ assertSame(columnNameIndexMap, getResultSetColumnNameIndexMap(rs), "Cached mapping should be same between different result sets of same named prepared statement"); - rs.close(); - pstmt.close(); - } -@@ -1441,8 +1436,8 @@ public class ResultSetTest extends BaseTest4 { - Future future1 = e.submit(new SelectTimestampManyTimes(con, year1)); - Integer year2 = 2017; - Future future2 = e.submit(new SelectTimestampManyTimes(con, year2)); -- assertEquals("Year was changed in another thread", year1, future1.get(1, TimeUnit.MINUTES)); -- assertEquals("Year was changed in another thread", year2, future2.get(1, TimeUnit.MINUTES)); -+ assertEquals(year1, future1.get(1, TimeUnit.MINUTES), "Year was changed in another thread"); -+ assertEquals(year2, future2.get(1, TimeUnit.MINUTES), "Year was changed in another thread"); - e.shutdown(); - e.awaitTermination(1, TimeUnit.MINUTES); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/ServerCursorTest.java b/src/test/java/org/postgresql/test/jdbc2/ServerCursorTest.java -index 113308d..be14996 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ServerCursorTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ServerCursorTest.java -@@ -5,11 +5,11 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - - import org.postgresql.test.TestUtil; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -58,9 +58,9 @@ public class ServerCursorTest extends BaseTest4 { - ResultSet rs = stmt.executeQuery(); - while (rs.next()) { - // there should only be one row returned -- assertEquals("query value error", 1, rs.getInt(1)); -+ assertEquals(1, rs.getInt(1), "query value error"); - byte[] dataBytes = rs.getBytes(2); -- assertEquals("binary data got munged", DATA_STRING, new String(dataBytes, "UTF8")); -+ assertEquals(DATA_STRING, new String(dataBytes, "UTF8"), "binary data got munged"); - } - - } -@@ -79,7 +79,7 @@ public class ServerCursorTest extends BaseTest4 { - while (rs.next()) { - // there should only be one row returned - byte[] dataBytes = rs.getBytes(2); -- assertEquals("binary data got munged", DATA_STRING, new String(dataBytes, "UTF8")); -+ assertEquals(DATA_STRING, new String(dataBytes, "UTF8"), "binary data got munged"); - } - - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/ServerErrorTest.java b/src/test/java/org/postgresql/test/jdbc2/ServerErrorTest.java -index 9f06d46..8197940 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ServerErrorTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ServerErrorTest.java -@@ -5,9 +5,9 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; -@@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException; - import org.postgresql.util.PSQLState; - import org.postgresql.util.ServerErrorMessage; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.SQLException; - import java.sql.Statement; -diff --git a/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java b/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java -index 372ac66..27a52ed 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGStatement; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -30,8 +30,7 @@ public class ServerPreparedStmtTest extends BaseTest4 { - public void setUp() throws Exception { - super.setUp(); - -- Assume.assumeTrue("Server-prepared statements are not supported in simple protocol, thus ignoring the tests", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "Server-prepared statements are not supported in simple protocol, thus ignoring the tests"); - - Statement stmt = con.createStatement(); - -@@ -103,7 +102,7 @@ public class ServerPreparedStmtTest extends BaseTest4 { - return; - } - setUseServerPrepare(pstmt, false); -- assertTrue(!pstmt.unwrap(PGStatement.class).isUseServerPrepare()); -+ assertFalse(pstmt.unwrap(PGStatement.class).isUseServerPrepare()); - - rs = pstmt.executeQuery(); - assertTrue(rs.next()); -@@ -138,7 +137,7 @@ public class ServerPreparedStmtTest extends BaseTest4 { - } - - setUseServerPrepare(pstmt, false); -- assertTrue(!pstmt.unwrap(PGStatement.class).isUseServerPrepare()); -+ assertFalse(pstmt.unwrap(PGStatement.class).isUseServerPrepare()); - - pstmt.setInt(1, 9); - rs = pstmt.executeQuery(); -@@ -284,13 +283,13 @@ public class ServerPreparedStmtTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); - assertEquals(1, rs.getInt(1)); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - - // Change to text parameter, check it still works. - pstmt.setString(1, "test string"); - rs = pstmt.executeQuery(); - assertTrue(rs.next()); - assertEquals("test string", rs.getString(1)); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/StatementTest.java b/src/test/java/org/postgresql/test/jdbc2/StatementTest.java -index f7b09e3..1b55af6 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/StatementTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/StatementTest.java -@@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; - import static org.junit.jupiter.api.Assertions.assertNull; - import static org.junit.jupiter.api.Assertions.assertTrue; - import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.Driver; - import org.postgresql.PGProperty; -@@ -24,7 +25,6 @@ import org.postgresql.util.PSQLState; - import org.postgresql.util.SharedTimer; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; - import org.junit.jupiter.api.Timeout; -@@ -54,9 +54,6 @@ import java.util.concurrent.TimeoutException; - import java.util.concurrent.atomic.AtomicInteger; - import java.util.concurrent.atomic.AtomicReference; - --/* --* Test for getObject --*/ - class StatementTest { - private Connection con; - -@@ -953,7 +950,7 @@ class StatementTest { - @Test - @Timeout(10) - void closeInProgressStatementProtocol32() throws Exception { -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)); - Properties props = new Properties(); - con.close(); - PGProperty.PROTOCOL_VERSION.set(props, "3.2"); -diff --git a/src/test/java/org/postgresql/test/jdbc2/StringTypeUnspecifiedArrayTest.java b/src/test/java/org/postgresql/test/jdbc2/StringTypeUnspecifiedArrayTest.java -index 18942e6..87b0a9c 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/StringTypeUnspecifiedArrayTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/StringTypeUnspecifiedArrayTest.java -@@ -5,26 +5,27 @@ - - package org.postgresql.test.jdbc2; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ - import org.postgresql.PGProperty; - import org.postgresql.geometric.PGbox; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Array; - import java.util.ArrayList; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class StringTypeUnspecifiedArrayTest extends BaseTest4 { - public StringTypeUnspecifiedArrayTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -43,6 +44,6 @@ public class StringTypeUnspecifiedArrayTest extends BaseTest4 { - public void testCreateArrayWithNonCachedType() throws Exception { - PGbox[] in = new PGbox[0]; - Array a = con.createArrayOf("box", in); -- Assert.assertEquals(1111, a.getBaseType()); -+ assertEquals(1111, a.getBaseType()); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java b/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java -index 19f97be..4857aed 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java -@@ -5,11 +5,11 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGStatement; - import org.postgresql.core.BaseConnection; -@@ -17,9 +17,9 @@ import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.TimestampUtils; - import org.postgresql.test.TestUtil; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Date; - import java.sql.PreparedStatement; -@@ -41,7 +41,8 @@ import java.util.TimeZone; - * TODO: refactor to a property-based testing or parameterized testing somehow so adding new times - * don't require to add constants and setters/getters. JUnit 5 would probably help here. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class TimestampTest extends BaseTest4 { - - public TimestampTest(BinaryMode binaryMode) { -@@ -50,7 +51,6 @@ public class TimestampTest extends BaseTest4 { - - private TimeZone currentTZ; - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -187,14 +187,10 @@ public class TimestampTest extends BaseTest4 { - - // Insert the three timestamp values in raw pg format - for (int i = 0; i < 3; i++) { -- assertEquals(1, -- stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS1WTZ_PGFORMAT + "'"))); -- assertEquals(1, -- stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS2WTZ_PGFORMAT + "'"))); -- assertEquals(1, -- stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS3WTZ_PGFORMAT + "'"))); -- assertEquals(1, -- stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS4WTZ_PGFORMAT + "'"))); -+ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS1WTZ_PGFORMAT + "'"))); -+ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS2WTZ_PGFORMAT + "'"))); -+ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS3WTZ_PGFORMAT + "'"))); -+ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS4WTZ_PGFORMAT + "'"))); - } - assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, - "'" + tsu.toString(null, new Timestamp(tmpDate1.getTime())) + "'"))); -@@ -361,8 +357,8 @@ public class TimestampTest extends BaseTest4 { - // With java.sql.Date, java.sql.Time - for (java.util.Date date : TEST_DATE_TIMES) { - pstmt.setObject(1, date, Types.TIMESTAMP); -- assertEquals("insert into TSWOTZ_TABLE via setObject(1, " + date -- + ", Types.TIMESTAMP) -> expecting one row inserted", 1, pstmt.executeUpdate()); -+ assertEquals(1, pstmt.executeUpdate(), "insert into TSWOTZ_TABLE via setObject(1, " + date -+ + ", Types.TIMESTAMP) -> expecting one row inserted"); - } - - // Fall through helper -@@ -563,7 +559,7 @@ public class TimestampTest extends BaseTest4 { - assertTrue(rs.next()); - t = rs.getTimestamp(1); - assertNotNull(t); -- assertEquals("rs.getTimestamp(1).getTime()", expected.getTime(), t.getTime()); -+ assertEquals(expected.getTime(), t.getTime(), "rs.getTimestamp(1).getTime()"); - } - - assertTrue(!rs.next()); // end of table. Fail if more entries exist. -@@ -588,10 +584,10 @@ public class TimestampTest extends BaseTest4 { - Integer tNanos = t.getNanos(); - Integer tzNanos = tz.getNanos(); - -- assertEquals("Time should be microsecond-accurate", desiredNanos, tNanos); -- assertEquals("Time with time zone should be microsecond-accurate", desiredNanos, tzNanos); -- assertEquals("Unix epoch timestamp and Time should match", ts, t); -- assertEquals("Unix epoch timestamp with time zone and time with time zone should match", tstz, tz); -+ assertEquals(desiredNanos, tNanos, "Time should be microsecond-accurate"); -+ assertEquals(desiredNanos, tzNanos, "Time with time zone should be microsecond-accurate"); -+ assertEquals(ts, t, "Unix epoch timestamp and Time should match"); -+ assertEquals(tstz, tz, "Unix epoch timestamp with time zone and time with time zone should match"); - } - - private static Timestamp getTimestamp(int y, int m, int d, int h, int mn, int se, int f, -diff --git a/src/test/java/org/postgresql/test/jdbc2/TimezoneCachingTest.java b/src/test/java/org/postgresql/test/jdbc2/TimezoneCachingTest.java -index 48389c1..8a0358f 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/TimezoneCachingTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/TimezoneCachingTest.java -@@ -5,14 +5,15 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assumptions.assumeFalse; - - import org.postgresql.core.BaseConnection; - import org.postgresql.jdbc.TimestampUtils; - import org.postgresql.test.TestUtil; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.lang.reflect.Field; - import java.sql.BatchUpdateException; -@@ -41,90 +42,52 @@ public class TimezoneCachingTest extends BaseTest4 { - PreparedStatement pstmt = null; - try { - pstmt = con.prepareStatement("INSERT INTO testtz VALUES (?,?)"); -- assertEquals( -- "Cache never initialized: must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache never initialized: must be null"); - pstmt.setInt(1, 1); -- assertEquals( -- "Cache never initialized: must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache never initialized: must be null"); - pstmt.setTimestamp(2, ts); -- assertEquals( -- "Cache initialized by setTimestamp(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setTimestamp(xx): must not be null"); - pstmt.addBatch(); -- assertEquals( -- "Cache was initialized, addBatch does not change that: must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache was initialized, addBatch does not change that: must not be null"); - pstmt.setInt(1, 2); - pstmt.setNull(2, java.sql.Types.DATE); -- assertEquals( -- "Cache was initialized, setNull does not change that: must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache was initialized, setNull does not change that: must not be null"); - pstmt.addBatch(); -- assertEquals( -- "Cache was initialized, addBatch does not change that: must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache was initialized, addBatch does not change that: must not be null"); - pstmt.executeBatch(); -- assertEquals( -- "Cache reset by executeBatch(): must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache reset by executeBatch(): must be null"); - pstmt.setInt(1, 3); -- assertEquals( -- "Cache not initialized: must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache not initialized: must be null"); - pstmt.setInt(1, 4); - pstmt.setNull(2, java.sql.Types.DATE); -- assertEquals( -- "Cache was not initialized, setNull does not change that: must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache was not initialized, setNull does not change that: must be null"); - pstmt.setTimestamp(2, ts); -- assertEquals( -- "Cache initialized by setTimestamp(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setTimestamp(xx): must not be null"); - pstmt.clearParameters(); -- assertEquals( -- "Cache was initialized, clearParameters does not change that: must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache was initialized, clearParameters does not change that: must not be null"); - pstmt.setInt(1, 5); - pstmt.setTimestamp(2, ts); - pstmt.addBatch(); - pstmt.executeBatch(); - pstmt.close(); - pstmt = con.prepareStatement("UPDATE testtz SET col2 = ? WHERE col1 = 1"); -- assertEquals( -- "Cache not initialized: must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache not initialized: must be null"); - pstmt.setDate(1, date); -- assertEquals( -- "Cache initialized by setDate(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setDate(xx): must not be null"); - pstmt.execute(); -- assertEquals( -- "Cache reset by execute(): must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache reset by execute(): must be null"); - pstmt.setDate(1, date); -- assertEquals( -- "Cache initialized by setDate(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setDate(xx): must not be null"); - pstmt.executeUpdate(); -- assertEquals( -- "Cache reset by executeUpdate(): must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache reset by executeUpdate(): must be null"); - pstmt.setTime(1, time); -- assertEquals( -- "Cache initialized by setTime(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setTime(xx): must not be null"); - pstmt.close(); - pstmt = con.prepareStatement("SELECT * FROM testtz WHERE col2 = ?"); - pstmt.setDate(1, date); -- assertEquals( -- "Cache initialized by setDate(xx): must not be null", -- tz, getTimeZoneCache(pstmt)); -+ assertEquals(tz, getTimeZoneCache(pstmt), "Cache initialized by setDate(xx): must not be null"); - pstmt.executeQuery(); -- assertEquals( -- "Cache reset by executeQuery(): must be null", -- null, getTimeZoneCache(pstmt)); -+ assertNull(getTimeZoneCache(pstmt), "Cache reset by executeQuery(): must be null"); - } finally { - TestUtil.closeQuietly(pstmt); - } -@@ -251,28 +214,26 @@ public class TimezoneCachingTest extends BaseTest4 { - stmt = con.createStatement(); - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); -- assertEquals("Cache never initialized: must be null", null, getTimeZoneCache(rs)); -+ assertNull(getTimeZoneCache(rs), "Cache never initialized: must be null"); - rs.getInt(1); -- assertEquals("Cache never initialized: must be null", null, getTimeZoneCache(rs)); -+ assertNull(getTimeZoneCache(rs), "Cache never initialized: must be null"); - rs.getTimestamp(2); -- assertEquals("Cache initialized by getTimestamp(x): must not be null", -- tz, getTimeZoneCache(rs)); -+ assertEquals(tz, getTimeZoneCache(rs), "Cache initialized by getTimestamp(x): must not be null"); - rs.close(); - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); - rs.getInt(1); -- assertEquals("Cache never initialized: must be null", null, getTimeZoneCache(rs)); -+ assertNull(getTimeZoneCache(rs), "Cache never initialized: must be null"); - rs.getObject(2); -- assertEquals("Cache initialized by getObject(x) on a DATE column: must not be null", -- tz, getTimeZoneCache(rs)); -+ assertEquals(tz, getTimeZoneCache(rs), "Cache initialized by getObject(x) on a DATE column: must not be null"); - rs.close(); - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); -- assertEquals("Cache should NOT be set", null, getTimeZoneCache(rs)); -+ assertNull(getTimeZoneCache(rs), "Cache should NOT be set"); - rs.getInt(1); -- assertEquals("Cache never initialized: must be null", null, getTimeZoneCache(rs)); -+ assertNull(getTimeZoneCache(rs), "Cache never initialized: must be null"); - rs.getDate(2); -- assertEquals("Cache initialized by getDate(x): must not be null", tz, getTimeZoneCache(rs)); -+ assertEquals(tz, getTimeZoneCache(rs), "Cache initialized by getDate(x): must not be null"); - rs.close(); - } finally { - TestUtil.closeQuietly(rs); -@@ -307,43 +268,25 @@ public class TimezoneCachingTest extends BaseTest4 { - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); - rs.getInt(1); -- assertEquals( -- "Current TZ is tz1, empty cache to be initialized to tz1 => retrieve in tz1, timestamps must be equal", -- ts1, rs.getTimestamp(2)); -+ assertEquals(ts1, rs.getTimestamp(2), "Current TZ is tz1, empty cache to be initialized to tz1 => retrieve in tz1, timestamps must be equal"); - rs.close(); - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); - rs.getInt(1); - TimeZone.setDefault(tz2); -- assertEquals( -- "Current TZ is tz2, empty cache to be initialized to tz2 => retrieve in tz2, timestamps cannot be equal", -- ts2, rs.getTimestamp(2)); -- assertEquals( -- "Explicit tz1 calendar, so timestamps must be equal", -- ts1, rs.getTimestamp(2, c1)); -- assertEquals( -- "Cache was initialized to tz2, so timestamps cannot be equal", -- ts2, rs.getTimestamp(2)); -+ assertEquals(ts2, rs.getTimestamp(2), "Current TZ is tz2, empty cache to be initialized to tz2 => retrieve in tz2, timestamps cannot be equal"); -+ assertEquals(ts1, rs.getTimestamp(2, c1), "Explicit tz1 calendar, so timestamps must be equal"); -+ assertEquals(ts2, rs.getTimestamp(2), "Cache was initialized to tz2, so timestamps cannot be equal"); - TimeZone.setDefault(tz1); -- assertEquals( -- "Cache was initialized to tz2, so timestamps cannot be equal", -- ts2, rs.getTimestamp(2)); -+ assertEquals(ts2, rs.getTimestamp(2), "Cache was initialized to tz2, so timestamps cannot be equal"); - rs.close(); - rs = stmt.executeQuery("SELECT col1, col2 FROM testtz"); - rs.next(); - rs.getInt(1); -- assertEquals( -- "Explicit tz2 calendar, so timestamps cannot be equal", -- ts2, rs.getTimestamp(2, c2)); -- assertEquals( -- "Current TZ is tz1, empty cache to be initialized to tz1 => retrieve in tz1, timestamps must be equal", -- ts1, rs.getTimestamp(2)); -- assertEquals( -- "Explicit tz2 calendar, so timestamps cannot be equal", -- ts2, rs.getTimestamp(2, c2)); -- assertEquals( -- "Explicit tz2 calendar, so timestamps must be equal", -- ts1, rs.getTimestamp(2, c1)); -+ assertEquals(ts2, rs.getTimestamp(2, c2), "Explicit tz2 calendar, so timestamps cannot be equal"); -+ assertEquals(ts1, rs.getTimestamp(2), "Current TZ is tz1, empty cache to be initialized to tz1 => retrieve in tz1, timestamps must be equal"); -+ assertEquals(ts2, rs.getTimestamp(2, c2), "Explicit tz2 calendar, so timestamps cannot be equal"); -+ assertEquals(ts1, rs.getTimestamp(2, c1), "Explicit tz2 calendar, so timestamps must be equal"); - rs.close(); - } finally { - TimeZone.setDefault(null); -@@ -362,7 +305,7 @@ public class TimezoneCachingTest extends BaseTest4 { - Timestamp dbTs = rs.getTimestamp(1); - rs.close(); - TimeZone.setDefault(prevTz); -- assertEquals(checkText, ts, dbTs); -+ assertEquals(ts, dbTs, checkText); - } - - private static TimeZone getTimeZoneCache(Object stmt) { -@@ -380,8 +323,8 @@ public class TimezoneCachingTest extends BaseTest4 { - public void setUp() throws Exception { - super.setUp(); - TimestampUtils timestampUtils = ((BaseConnection) con).getTimestampUtils(); -- Assume.assumeFalse("If connection has fast access to TimeZone.getDefault," -- + " then no cache is needed", timestampUtils.hasFastDefaultTimeZone()); -+ assumeFalse(timestampUtils.hasFastDefaultTimeZone(), "If connection has fast access to TimeZone.getDefault," -+ + " then no cache is needed"); - /* Drop the test table if it already exists for some reason. It is - not an error if it doesn't exist. */ - TestUtil.createTable(con, "testtz", "col1 INTEGER, col2 TIMESTAMP"); -diff --git a/src/test/java/org/postgresql/test/jdbc2/TypeCacheDLLStressTest.java b/src/test/java/org/postgresql/test/jdbc2/TypeCacheDLLStressTest.java -index 1402f8a..1cb7c22 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/TypeCacheDLLStressTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/TypeCacheDLLStressTest.java -@@ -7,7 +7,7 @@ package org.postgresql.test.jdbc2; - - import org.postgresql.test.TestUtil; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Connection; - import java.sql.ResultSet; -diff --git a/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java b/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java -index 8fc3e1f..d758dd6 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java -@@ -5,20 +5,19 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertArrayEquals; --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertArrayEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.ByteArrayInputStream; - import java.io.StringReader; -@@ -692,7 +691,7 @@ public class UpdateableResultTest extends BaseTest4 { - @Test - public void simpleAndUpdateableSameQuery() throws Exception { - PGConnection unwrap = con.unwrap(PGConnection.class); -- Assume.assumeNotNull(unwrap); -+ assumeTrue(unwrap != null, "con.unwrap(PGConnection.class) should not be null"); - int prepareThreshold = unwrap.getPrepareThreshold(); - String sql = "select * from second where id1=?"; - for (int i = 0; i <= prepareThreshold; i++) { -@@ -704,9 +703,9 @@ public class UpdateableResultTest extends BaseTest4 { - rs = ps.executeQuery(); - rs.next(); - String name1 = rs.getString("name1"); -- Assert.assertEquals("anyvalue", name1); -+ assertEquals("anyvalue", name1); - int id1 = rs.getInt("id1"); -- Assert.assertEquals(1, id1); -+ assertEquals(1, id1); - } finally { - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(ps); -@@ -722,9 +721,9 @@ public class UpdateableResultTest extends BaseTest4 { - rs = ps.executeQuery(); - rs.next(); - String name1 = rs.getString("name1"); -- Assert.assertEquals("anyvalue", name1); -+ assertEquals("anyvalue", name1); - int id1 = rs.getInt("id1"); -- Assert.assertEquals(1, id1); -+ assertEquals(1, id1); - rs.updateString("name1", "updatedValue"); - rs.updateRow(); - } finally { -@@ -777,8 +776,7 @@ public class UpdateableResultTest extends BaseTest4 { - rs.updateString("name1", "bob"); - fail("Should have failed since unique column u1 is nullable"); - } catch (SQLException ex) { -- assertEquals("No eligible primary or unique key found for table unique_null_constraint.", -- ex.getMessage()); -+ assertEquals("No eligible primary or unique key found for table unique_null_constraint.", ex.getMessage()); - } - rs.close(); - st.close(); -@@ -875,8 +873,7 @@ public class UpdateableResultTest extends BaseTest4 { - rs.updateDate("dt", Date.valueOf("1999-01-01")); - fail("Should have failed since id2 is nullable column"); - } catch (SQLException ex) { -- assertEquals("No eligible primary or unique key found for table uniquekeys.", -- ex.getMessage()); -+ assertEquals("No eligible primary or unique key found for table uniquekeys.", ex.getMessage()); - } - rs.close(); - st.close(); -@@ -893,8 +890,7 @@ public class UpdateableResultTest extends BaseTest4 { - rs.updateDate("dt", Date.valueOf("1999-01-01")); - fail("Should have failed since no UK/PK are in the select statement"); - } catch (SQLException ex) { -- assertEquals("No eligible primary or unique key found for table uniquekeys.", -- ex.getMessage()); -+ assertEquals("No eligible primary or unique key found for table uniquekeys.", ex.getMessage()); - } - rs.close(); - st.close(); -diff --git a/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java b/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java -index 6e713d4..e94eb58 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java -@@ -5,15 +5,14 @@ - - package org.postgresql.test.jdbc2; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -25,14 +24,14 @@ import java.util.Collection; - /** - * Tests {@code INSERT .. ON CONFLICT} introduced in PostgreSQL 9.5. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, reWriteBatchedInserts = {1}") -+@MethodSource("data") - public class UpsertTest extends BaseTest4 { - public UpsertTest(BinaryMode binaryMode, ReWriteBatchedInserts rewrite) { - setBinaryMode(binaryMode); - setReWriteBatchedInserts(rewrite); - } - -- @Parameterized.Parameters(name = "binary = {0}, reWriteBatchedInserts = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -71,32 +70,28 @@ public class UpsertTest extends BaseTest4 { - public void testUpsertDoNothingConflict() throws SQLException { - int count = executeUpdate( - "INSERT INTO test_statement(i, t) VALUES (42, '42') ON CONFLICT DO NOTHING"); -- assertEquals("insert on CONFLICT DO NOTHING should report 0 modified rows on CONFLICT", -- 0, count); -+ assertEquals(0, count, "insert on CONFLICT DO NOTHING should report 0 modified rows on CONFLICT"); - } - - @Test - public void testUpsertDoNothingNoConflict() throws SQLException { - int count = executeUpdate( - "INSERT INTO test_statement(i, t) VALUES (43, '43') ON CONFLICT DO NOTHING"); -- assertEquals("insert on conflict DO NOTHING should report 1 modified row on plain insert", -- 1, count); -+ assertEquals(1, count, "insert on conflict DO NOTHING should report 1 modified row on plain insert"); - } - - @Test - public void testUpsertDoUpdateConflict() throws SQLException { - int count = executeUpdate( - "INSERT INTO test_statement(i, t) VALUES (42, '42') ON CONFLICT(i) DO UPDATE SET t='43'"); -- assertEquals("insert ON CONFLICT DO UPDATE should report 1 modified row on CONFLICT", -- 1, count); -+ assertEquals(1, count, "insert ON CONFLICT DO UPDATE should report 1 modified row on CONFLICT"); - } - - @Test - public void testUpsertDoUpdateNoConflict() throws SQLException { - int count = executeUpdate( - "INSERT INTO test_statement(i, t) VALUES (43, '43') ON CONFLICT(i) DO UPDATE SET t='43'"); -- assertEquals("insert on conflict do update should report 1 modified row on plain insert", -- 1, count); -+ assertEquals(1, count, "insert on conflict do update should report 1 modified row on plain insert"); - } - - @Test -@@ -142,7 +137,7 @@ public class UpsertTest extends BaseTest4 { - ResultSet rs = - st.executeQuery("select count(*) from test_statement where i between 50 and 53"); - rs.next(); -- Assert.assertEquals("test_statement should have 4 rows with 'i' of 50..53", 4, rs.getInt(1)); -+ assertEquals(4, rs.getInt(1), "test_statement should have 4 rows with 'i' of 50..53"); - } finally { - TestUtil.closeQuietly(ps); - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java b/src/test/java/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java -index 918e9a7..e794e4b 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java -@@ -5,21 +5,20 @@ - - package org.postgresql.test.jdbc2.optional; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertNotSame; --import static org.junit.Assert.assertSame; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNotSame; -+import static org.junit.jupiter.api.Assertions.assertSame; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGConnection; - import org.postgresql.ds.common.BaseDataSource; - import org.postgresql.test.TestUtil; -+import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.test.util.MiniJndiContextFactory; - import org.postgresql.util.PSQLException; - --import org.junit.After; --import org.junit.Before; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Connection; - import java.sql.ResultSet; -@@ -38,16 +37,15 @@ import javax.naming.NamingException; - * - * @author Aaron Mulder (ammulder@chariotsolutions.com) - */ --public abstract class BaseDataSourceTest { -+public abstract class BaseDataSourceTest extends BaseTest4 { - public static final String DATA_SOURCE_JNDI = "BaseDataSource"; - -- protected Connection con; - protected BaseDataSource bds; - - /** - * Creates a test table using a standard connection (not from a DataSource). - */ -- @Before -+ @Override - public void setUp() throws Exception { - con = TestUtil.openDB(); - TestUtil.createTable(con, "poolingtest", "id int4 not null primary key, name varchar(50)"); -@@ -60,8 +58,8 @@ public abstract class BaseDataSourceTest { - /** - * Removes the test table using a standard connection (not from a DataSource). - */ -- @After -- public void tearDown() throws Exception { -+ @Override -+ public void tearDown() throws SQLException { - TestUtil.closeDB(con); - con = TestUtil.openDB(); - TestUtil.dropTable(con, "poolingtest"); -@@ -200,7 +198,7 @@ public abstract class BaseDataSourceTest { - try { - ic.rebind(DATA_SOURCE_JNDI, bds); - bds = (BaseDataSource) ic.lookup(DATA_SOURCE_JNDI); -- assertNotNull("Got null looking up DataSource from JNDI!", bds); -+ assertNotNull(bds, "Got null looking up DataSource from JNDI!"); - compareJndiDataSource(oldbds, bds); - } catch (NamingException e) { - fail(e.getMessage()); -@@ -208,10 +206,8 @@ public abstract class BaseDataSourceTest { - oldbds = bds; - String url = bds.getURL(); - testUseConnection(); -- assertSame("Test should not have changed DataSource (" + bds + " != " + oldbds + ")!", -- oldbds, bds); -- assertEquals("Test should not have changed DataSource URL", -- oldurl, url); -+ assertSame(oldbds, bds, "Test should not have changed DataSource (" + bds + " != " + oldbds + ")!"); -+ assertEquals(oldurl, url, "Test should not have changed DataSource URL"); - } - - /** -@@ -232,6 +228,6 @@ public abstract class BaseDataSourceTest { - * Check whether a DS was dereferenced from JNDI or recreated. - */ - protected void compareJndiDataSource(BaseDataSource oldbds, BaseDataSource bds) { -- assertNotSame("DataSource was dereferenced, should have been serialized or recreated", oldbds, bds); -+ assertNotSame(oldbds, bds, "DataSource was dereferenced, should have been serialized or recreated"); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java b/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java -index e4a76c6..19d608d 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java -@@ -5,9 +5,12 @@ - - package org.postgresql.test.jdbc2.optional; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotSame; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.ds.PGConnectionPoolDataSource; -@@ -15,8 +18,7 @@ import org.postgresql.jdbc2.optional.ConnectionPool; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLException; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.ByteArrayInputStream; - import java.io.ByteArrayOutputStream; -@@ -55,7 +57,7 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - } - - @Override -- public void tearDown() throws Exception { -+ public void tearDown() throws SQLException { - for (PooledConnection c : connections) { - try { - c.close(); -@@ -124,8 +126,7 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - String name2 = con.toString(); - con.close(); - pc.close(); -- assertTrue("Physical connection doesn't appear to be reused across PooledConnection wrappers", -- name.equals(name2)); -+ assertEquals(name, name2, "Physical connection doesn't appear to be reused across PooledConnection wrappers"); - } catch (SQLException e) { - fail(e.getMessage()); - } -@@ -143,8 +144,7 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - Connection con2 = pc.getConnection(); - try { - con.createStatement(); -- fail( -- "Original connection wrapper should be closed when new connection wrapper is generated"); -+ fail("Original connection wrapper should be closed when new connection wrapper is generated"); - } catch (SQLException e) { - } - con2.close(); -@@ -167,9 +167,7 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - Connection con2 = pc.getConnection(); - con2.close(); - pc.close(); -- assertTrue( -- "Two calls to PooledConnection.getConnection should not return the same connection wrapper", -- con != con2); -+ assertNotSame(con, con2, "Two calls to PooledConnection.getConnection should not return the same connection wrapper"); - } catch (SQLException e) { - fail(e.getMessage()); - } -@@ -279,7 +277,7 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - assertEquals(0, cc.getErrorCount()); - // Open a 2nd connection, causing the first to be closed. No even should be generated. - Connection con2 = pc.getConnection(); -- assertTrue("Connection handle was not closed when new handle was opened", con.isClosed()); -+ assertTrue(con.isClosed(), "Connection handle was not closed when new handle was opened"); - assertEquals(1, cc.getCount()); - assertEquals(0, cc.getErrorCount()); - con2.close(); -@@ -300,13 +298,13 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - try { - PooledConnection pc = getPooledConnection(); - con = pc.getConnection(); -- assertTrue(!con.isClosed()); -+ assertFalse(con.isClosed()); - con.close(); - assertTrue(con.isClosed()); - con = pc.getConnection(); - Connection con2 = pc.getConnection(); - assertTrue(con.isClosed()); -- assertTrue(!con2.isClosed()); -+ assertFalse(con2.isClosed()); - con2.close(); - assertTrue(con.isClosed()); - pc.close(); -@@ -324,10 +322,9 @@ public class ConnectionPoolTest extends BaseDataSourceTest { - try { - PooledConnection pc = getPooledConnection(); - con = pc.getConnection(); -- assertTrue(!con.isClosed()); -+ assertFalse(con.isClosed()); - -- Assume.assumeTrue("pg_terminate_backend requires PostgreSQL 8.4+", -- TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4), "pg_terminate_backend requires PostgreSQL 8.4+"); - - TestUtil.terminateBackend(con); - try { -diff --git a/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java b/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java -index ddfbe47..3ed3f49 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java -@@ -5,15 +5,15 @@ - - package org.postgresql.test.jdbc2.optional; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertSame; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertSame; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.ds.common.BaseDataSource; - import org.postgresql.jdbc2.optional.PoolingDataSource; - import org.postgresql.util.PSQLException; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Connection; - import java.sql.ResultSet; -@@ -29,7 +29,7 @@ public class PoolingDataSourceTest extends BaseDataSourceTest { - private static final String DS_NAME = "JDBC 2 SE Test DataSource"; - - @Override -- public void tearDown() throws Exception { -+ public void tearDown() throws SQLException { - if (bds instanceof PoolingDataSource) { - ((PoolingDataSource) bds).close(); - } -@@ -61,7 +61,7 @@ public class PoolingDataSourceTest extends BaseDataSourceTest { - con = getDataSourceConnection(); - String name2 = con.toString(); - con.close(); -- assertEquals("Pooled DS doesn't appear to be pooling connections!", name, name2); -+ assertEquals(name, name2, "Pooled DS doesn't appear to be pooling connections!"); - } - - /** -@@ -69,8 +69,7 @@ public class PoolingDataSourceTest extends BaseDataSourceTest { - */ - @Override - protected void compareJndiDataSource(BaseDataSource oldbds, BaseDataSource bds) { -- assertSame("DataSource was serialized or recreated, should have been dereferenced", -- bds, oldbds); -+ assertSame(bds, oldbds, "DataSource was serialized or recreated, should have been dereferenced"); - } - - /** -diff --git a/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java b/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java -index 2064c24..c8b7fa1 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java -@@ -5,11 +5,13 @@ - - package org.postgresql.test.jdbc2.optional; - -+import static org.junit.jupiter.api.Assertions.assertThrows; -+ - import org.postgresql.ds.PGSimpleDataSource; - import org.postgresql.jdbc2.optional.SimpleDataSource; - import org.postgresql.util.PSQLException; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - /** - * Performs the basic tests defined in the superclass. Just adds the configuration logic. -@@ -29,10 +31,13 @@ public class SimpleDataSourceTest extends BaseDataSourceTest { - } - } - -- @Test(expected = IllegalArgumentException.class) -+ @Test - public void testTypoPostgresUrl() { - PGSimpleDataSource ds = new PGSimpleDataSource(); -- // this should fail because the protocol is wrong. -- ds.setUrl("jdbc:postgres://localhost:5432/test"); -+ String url = "jdbc:postgres://localhost:5432/test"; -+ assertThrows( -+ IllegalArgumentException.class, -+ () -> ds.setUrl(url), -+ () -> "protocols is wrong when calling ds.setUrl(\"" + url + "\")"); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceWithSetURLTest.java b/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceWithSetURLTest.java -index 2322f7b..07eb412 100644 ---- a/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceWithSetURLTest.java -+++ b/src/test/java/org/postgresql/test/jdbc2/optional/SimpleDataSourceWithSetURLTest.java -@@ -5,7 +5,7 @@ - - package org.postgresql.test.jdbc2.optional; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.postgresql.Driver.parseURL; - - import org.postgresql.PGProperty; -@@ -13,7 +13,7 @@ import org.postgresql.jdbc2.optional.SimpleDataSource; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLException; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.util.Properties; - -diff --git a/src/test/java/org/postgresql/test/jdbc3/CompositeTest.java b/src/test/java/org/postgresql/test/jdbc3/CompositeTest.java -index 34c31d6..43784ff 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/CompositeTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/CompositeTest.java -@@ -8,6 +8,7 @@ package org.postgresql.test.jdbc3; - import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.junit.jupiter.api.Assertions.assertNull; - import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.core.ServerVersion; -@@ -16,7 +17,6 @@ import org.postgresql.test.TestUtil; - import org.postgresql.util.PGobject; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeAll; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; -@@ -33,11 +33,8 @@ class CompositeTest { - - @BeforeAll - static void beforeClass() throws Exception { -- Connection conn = TestUtil.openDB(); -- try { -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3), "uuid requires PostgreSQL 8.3+"); -- } finally { -- conn.close(); -+ try (Connection conn = TestUtil.openDB();) { -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3), "uuid requires PostgreSQL 8.3+"); - } - } - -@@ -89,7 +86,7 @@ class CompositeTest { - - @Test - void simpleArgumentSelect() throws SQLException { -- Assumptions.assumeTrue(conn.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE, "Skip if running in simple query mode"); -+ assumeTrue(conn.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE, "Skip if running in simple query mode"); - PreparedStatement pstmt = conn.prepareStatement("SELECT ?"); - PGobject pgo = new PGobject(); - pgo.setType("simplecompositetest"); -@@ -103,7 +100,7 @@ class CompositeTest { - - @Test - void complexArgumentSelect() throws SQLException { -- Assumptions.assumeTrue(conn.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE, "Skip if running in simple query mode"); -+ assumeTrue(conn.unwrap(PGConnection.class).getPreferQueryMode() != PreferQueryMode.SIMPLE, "Skip if running in simple query mode"); - PreparedStatement pstmt = conn.prepareStatement("SELECT ?"); - PGobject pgo = new PGobject(); - pgo.setType("\"Composites\".\"ComplexCompositeTest\""); -diff --git a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallIfNoReturnTest.java b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallIfNoReturnTest.java -index 94f012d..ed29cd4 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallIfNoReturnTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallIfNoReturnTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.EscapeSyntaxCallMode; - import org.postgresql.util.PSQLState; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.SQLException; -@@ -62,7 +62,7 @@ public class EscapeSyntaxCallModeCallIfNoReturnTest extends EscapeSyntaxCallMode - cs.setInt(3, 20); - cs.execute(); - int ret = cs.getInt(1); -- assertTrue("Expected mysumproc(10,20) to return 30 but returned " + ret, ret == 30); -+ assertEquals(30, ret, "mysumproc(10,20)"); - } - - @Test -@@ -81,7 +81,7 @@ public class EscapeSyntaxCallModeCallIfNoReturnTest extends EscapeSyntaxCallMode - // Expected output: a==1 (param 1), b==10 (param 2) - int a = cs.getInt(1); - int b = cs.getInt(2); -- assertTrue("Expected myioproc() to return output parameter values 1,10 but returned " + a + "," + b, (a == 1 && b == 10)); -+ assertTrue((a == 1 && b == 10), "Expected myioproc() to return output parameter values 1,10 but returned " + a + "," + b); - } - - } -diff --git a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallTest.java b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallTest.java -index 93bd5c1..c258c1e 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeCallTest.java -@@ -5,9 +5,9 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; -@@ -15,7 +15,7 @@ import org.postgresql.jdbc.EscapeSyntaxCallMode; - import org.postgresql.test.TestUtil; - import org.postgresql.util.PSQLState; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.SQLException; -@@ -91,7 +91,7 @@ public class EscapeSyntaxCallModeCallTest extends EscapeSyntaxCallModeBaseTest { - // Expected output: a==1 (param 1), b==10 (param 2) - int a = cs.getInt(1); - int b = cs.getInt(2); -- assertTrue("Expected myioproc() to return output parameter values 1,10 but returned " + a + "," + b, (a == 1 && b == 10)); -+ assertTrue((a == 1 && b == 10), "Expected myioproc() to return output parameter values 1,10 but returned " + a + "," + b); - } - - } -diff --git a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeSelectTest.java b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeSelectTest.java -index 73b4008..8eda461 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeSelectTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/EscapeSyntaxCallModeSelectTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.EscapeSyntaxCallMode; - import org.postgresql.util.PSQLState; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.SQLException; -@@ -42,7 +42,7 @@ public class EscapeSyntaxCallModeSelectTest extends EscapeSyntaxCallModeBaseTest - // Expected output: a==1 (param 1), b==10 (param 2) - int a = cs.getInt(1); - int b = cs.getInt(2); -- assertTrue("Expected myiofunc() to return output parameter values 1,10 but returned " + a + "," + b, (a == 1 && b == 10)); -+ assertTrue((a == 1 && b == 10), "Expected myiofunc() to return output parameter values 1,10 but returned " + a + "," + b); - } - - @Test -@@ -56,7 +56,7 @@ public class EscapeSyntaxCallModeSelectTest extends EscapeSyntaxCallModeBaseTest - cs.setInt(3, 20); - cs.execute(); - int ret = cs.getInt(1); -- assertTrue("Expected mysumfunc(10,20) to return 30 but returned " + ret, ret == 30); -+ assertEquals(30, ret, "mysumfunc(10,20)"); - } - - @Test -diff --git a/src/test/java/org/postgresql/test/jdbc3/GeneratedKeysTest.java b/src/test/java/org/postgresql/test/jdbc3/GeneratedKeysTest.java -index a7498ef..f08d386 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/GeneratedKeysTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/GeneratedKeysTest.java -@@ -5,12 +5,13 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGStatement; - import org.postgresql.core.ServerVersion; -@@ -18,10 +19,9 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -31,7 +31,8 @@ import java.sql.Statement; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "returningInQuery = {0}, binary = {1}") -+@MethodSource("data") - public class GeneratedKeysTest extends BaseTest4 { - public enum ReturningInQuery { - A("a"), -@@ -76,7 +77,6 @@ public class GeneratedKeysTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "returningInQuery = {0}, binary = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (ReturningInQuery returningInQuery : ReturningInQuery.values()) { -@@ -125,7 +125,7 @@ public class GeneratedKeysTest extends BaseTest4 { - assertEquals("2", rs.getString(3)); - assertEquals(2, rs.getInt("c")); - } -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -135,7 +135,7 @@ public class GeneratedKeysTest extends BaseTest4 { - Statement.RETURN_GENERATED_KEYS); - assertEquals(1, stmt.getUpdateCount()); - assertNull(stmt.getResultSet()); -- assertTrue(!stmt.getMoreResults()); -+ assertFalse(stmt.getMoreResults()); - } - - @Test -@@ -145,7 +145,7 @@ public class GeneratedKeysTest extends BaseTest4 { - Statement.RETURN_GENERATED_KEYS); - ResultSet rs = stmt.getGeneratedKeys(); - stmt.close(); -- assertTrue("statement was closed, thus the resultset should be closed as well", rs.isClosed()); -+ assertTrue(rs.isClosed(), "statement was closed, thus the resultset should be closed as well"); - try { - rs.next(); - fail("Can't operate on a closed result set."); -@@ -167,8 +167,7 @@ public class GeneratedKeysTest extends BaseTest4 { - Statement.NO_GENERATED_KEYS); - assertEquals(1, count); - if (returningInQuery.columnsReturned() > 0) { -- fail( -- "A result was returned when none was expected error should happen when executing executeUpdate('... returning ...')"); -+ fail("A result was returned when none was expected error should happen when executing executeUpdate('... returning ...')"); - } - } catch (SQLException e) { - if (returningInQuery.columnsReturned() > 0 && "0100E".equals(e.getSQLState())) { -@@ -178,7 +177,7 @@ public class GeneratedKeysTest extends BaseTest4 { - throw e; - } - ResultSet rs = stmt.getGeneratedKeys(); -- assertFalse("Statement.NO_GENERATED_KEYS => stmt.getGeneratedKeys() should be empty", rs.next()); -+ assertFalse(rs.next(), "Statement.NO_GENERATED_KEYS => stmt.getGeneratedKeys() should be empty"); - } - - @Test -@@ -193,7 +192,7 @@ public class GeneratedKeysTest extends BaseTest4 { - assertCB1(rs); - assertTrue(rs.next()); - assertCB2(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -208,7 +207,7 @@ public class GeneratedKeysTest extends BaseTest4 { - assertEquals(1, rs.getInt(1)); - assertTrue(rs.next()); - assertEquals(2, rs.getInt(1)); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -221,7 +220,7 @@ public class GeneratedKeysTest extends BaseTest4 { - ResultSet rs = stmt.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -235,24 +234,24 @@ public class GeneratedKeysTest extends BaseTest4 { - ResultSet rs = stmt.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test - public void testWithInsertSelect() throws SQLException { - assumeMinimumServerVersion(ServerVersion.v9_1); -- Assume.assumeTrue(returningInQuery != ReturningInQuery.NO); -+ assumeTrue(returningInQuery != ReturningInQuery.NO); - Statement stmt = con.createStatement(); - int count = stmt.executeUpdate( - "WITH x as (INSERT INTO genkeys(a,b,c) VALUES (1, 'a', 2) " + returningClause - + ") select * from x", - new String[]{"c", "b"}); -- assertEquals("rowcount", -1, count); -+ assertEquals(-1, count, "rowcount"); - // TODO: should SELECT produce rows through getResultSet or getGeneratedKeys? - ResultSet rs = stmt.getResultSet(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -265,7 +264,7 @@ public class GeneratedKeysTest extends BaseTest4 { - ResultSet rs = stmt.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -283,7 +282,7 @@ public class GeneratedKeysTest extends BaseTest4 { - ResultSet rs = ps.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -301,14 +300,14 @@ public class GeneratedKeysTest extends BaseTest4 { - ResultSet rs = ps.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB1(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - - ps.setInt(1, 2); - assertEquals(1, ps.executeUpdate()); - rs = ps.getGeneratedKeys(); - assertTrue(rs.next()); - assertCB2(rs); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - private void assertCB1(ResultSet rs) throws SQLException { -@@ -323,30 +322,26 @@ public class GeneratedKeysTest extends BaseTest4 { - String columnNames = sb.toString(); - switch (returningInQuery) { - case NO: -- assertEquals("Two columns should be returned since returning clause was empty and {c, b} was requested via API", -- "c, b", columnNames); -+ assertEquals("c, b", columnNames, "Two columns should be returned since returning clause was empty and {c, b} was requested via API"); - assertEquals(2, rs.getInt(1)); - assertEquals("a", rs.getString(2)); - assertEquals(2, rs.getInt("c")); - assertEquals("a", rs.getString("b")); - break; - case A: -- assertEquals("Just one column should be returned since returning clause was " + returningClause, -- "a", columnNames); -+ assertEquals("a", columnNames, "Just one column should be returned since returning clause was " + returningClause); - assertEquals(1, rs.getInt(1)); - assertEquals(1, rs.getInt("a")); - break; - case AB: -- assertEquals("Two columns should be returned since returning clause was " + returningClause, -- "a, b", columnNames); -+ assertEquals("a, b", columnNames, "Two columns should be returned since returning clause was " + returningClause); - assertEquals(1, rs.getInt(1)); - assertEquals("a", rs.getString(2)); - assertEquals(1, rs.getInt("a")); - assertEquals("a", rs.getString("b")); - break; - case STAR: -- assertEquals("Three columns should be returned since returning clause was " + returningClause, -- "a, b, c", columnNames); -+ assertEquals("a, b, c", columnNames, "Three columns should be returned since returning clause was " + returningClause); - assertEquals(1, rs.getInt(1)); - assertEquals("a", rs.getString(2)); - assertEquals(2, rs.getInt(3)); -@@ -362,25 +357,21 @@ public class GeneratedKeysTest extends BaseTest4 { - private void assertCB2(ResultSet rs) throws SQLException { - switch (returningInQuery) { - case NO: -- assertEquals("Two columns should be returned since returning clause was empty and {c, b} was requested via API", -- 2, rs.getMetaData().getColumnCount()); -+ assertEquals(2, rs.getMetaData().getColumnCount(), "Two columns should be returned since returning clause was empty and {c, b} was requested via API"); - assertEquals(4, rs.getInt(1)); - assertEquals("b", rs.getString(2)); - break; - case A: -- assertEquals("Just one column should be returned since returning clause was " + returningClause, -- 1, rs.getMetaData().getColumnCount()); -+ assertEquals(1, rs.getMetaData().getColumnCount(), "Just one column should be returned since returning clause was " + returningClause); - assertEquals(2, rs.getInt(1)); - break; - case AB: -- assertEquals("Two columns should be returned since returning clause was " + returningClause, -- 2, rs.getMetaData().getColumnCount()); -+ assertEquals(2, rs.getMetaData().getColumnCount(), "Two columns should be returned since returning clause was " + returningClause); - assertEquals(2, rs.getInt(1)); - assertEquals("b", rs.getString(2)); - break; - case STAR: -- assertEquals("Three columns should be returned since returning clause was " + returningClause, -- 3, rs.getMetaData().getColumnCount()); -+ assertEquals(3, rs.getMetaData().getColumnCount(), "Three columns should be returned since returning clause was " + returningClause); - assertEquals(2, rs.getInt(1)); - assertEquals("b", rs.getString(2)); - assertEquals(4, rs.getInt(3)); -@@ -409,7 +400,7 @@ public class GeneratedKeysTest extends BaseTest4 { - throw e; - } - rs = stmt.getGeneratedKeys(); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -422,11 +413,11 @@ public class GeneratedKeysTest extends BaseTest4 { - ps.addBatch(); - ps.executeBatch(); - ResultSet rs = ps.getGeneratedKeys(); -- assertTrue("getGeneratedKeys.next() should be non-empty", rs.next()); -+ assertTrue(rs.next(), "getGeneratedKeys.next() should be non-empty"); - assertEquals(1, rs.getInt("a")); - assertTrue(rs.next()); - assertEquals(2, rs.getInt("a")); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - private PreparedStatement prepareSelect() throws SQLException { -@@ -449,7 +440,7 @@ public class GeneratedKeysTest extends BaseTest4 { - public void selectWithGeneratedKeysViaPreparedExecuteQuery() throws SQLException { - PreparedStatement ps = prepareSelect(); - ResultSet rs = ps.executeQuery(); -- assertFalse("genkeys table is empty, thus rs.next() should return false", rs.next()); -+ assertFalse(rs.next(), "genkeys table is empty, thus rs.next() should return false"); - ps.close(); - } - -@@ -458,7 +449,7 @@ public class GeneratedKeysTest extends BaseTest4 { - PreparedStatement ps = prepareSelect(); - ps.execute(); - ResultSet rs = ps.getResultSet(); -- assertFalse("genkeys table is empty, thus rs.next() should return false", rs.next()); -+ assertFalse(rs.next(), "genkeys table is empty, thus rs.next() should return false"); - ps.close(); - } - -@@ -480,8 +471,8 @@ public class GeneratedKeysTest extends BaseTest4 { - s.execute(sql, returningInQuery.columns); - rs = s.getResultSet(); - } -- assertNotNull("SELECT statement should return results via getResultSet, not getGeneratedKeys", rs); -- assertFalse("genkeys table is empty, thus rs.next() should return false", rs.next()); -+ assertNotNull(rs, "SELECT statement should return results via getResultSet, not getGeneratedKeys"); -+ assertFalse(rs.next(), "genkeys table is empty, thus rs.next() should return false"); - s.close(); - } - -diff --git a/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java b/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java -index 474dbfc..9de5acb 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java -@@ -5,19 +5,19 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.BeforeClass; --import org.junit.Test; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; - - import java.math.BigDecimal; - import java.sql.CallableStatement; -@@ -33,7 +33,7 @@ import java.time.LocalDate; - * @author davec - */ - public class Jdbc3CallableStatementTest extends BaseTest4 { -- @BeforeClass -+ @BeforeAll - public static void beforeClass() throws Exception { - try (Connection con = TestUtil.openDB()) { - assumeCallableStatementsSupported(con); -@@ -214,18 +214,15 @@ public class Jdbc3CallableStatementTest extends BaseTest4 { - - call.executeUpdate(); - BigDecimal ret = call.getBigDecimal(1); -- assertTrue( -- "correct return from getNumeric () should be 999999999999999.000000000000000 but returned " -- + ret.toString(), -- ret.equals(new BigDecimal("999999999999999.000000000000000"))); -+ assertTrue(ret.equals(new BigDecimal("999999999999999.000000000000000")), "correct return from getNumeric () should be 999999999999999.000000000000000 but returned " -+ + ret.toString()); - - ret = call.getBigDecimal(2); -- assertTrue("correct return from getNumeric ()", -- ret.equals(new BigDecimal("0.000000000000001"))); -+ assertTrue(ret.equals(new BigDecimal("0.000000000000001")), "correct return from getNumeric ()"); - try { - ret = call.getBigDecimal(3); - } catch (NullPointerException ex) { -- assertTrue("This should be null", call.wasNull()); -+ assertTrue(call.wasNull(), "This should be null"); - } - } - -@@ -1055,7 +1052,7 @@ public class Jdbc3CallableStatementTest extends BaseTest4 { - cs.setInt(2, 2); - cs.setInt(3, 3); - cs.execute(); -- assertEquals("2+3 should be 5 when executed via {?= call mysum(?, ?)}", 5, cs.getInt(1)); -+ assertEquals(5, cs.getInt(1), "2+3 should be 5 when executed via {?= call mysum(?, ?)}"); - } - - @Test -@@ -1063,7 +1060,7 @@ public class Jdbc3CallableStatementTest extends BaseTest4 { - CallableStatement cs = con.prepareCall("{?= call mynoparams()}"); - cs.registerOutParameter(1, Types.INTEGER); - cs.execute(); -- assertEquals("{?= call mynoparam()} should return 733, but did not.", 733, cs.getInt(1)); -+ assertEquals(733, cs.getInt(1), "{?= call mynoparam()} should return 733, but did not."); - TestUtil.closeQuietly(cs); - } - -@@ -1072,7 +1069,7 @@ public class Jdbc3CallableStatementTest extends BaseTest4 { - CallableStatement cs = con.prepareCall("{?= call mynoparams}"); - cs.registerOutParameter(1, Types.INTEGER); - cs.execute(); -- assertEquals("{?= call mynoparam()} should return 733, but did not.", 733, cs.getInt(1)); -+ assertEquals(733, cs.getInt(1), "{?= call mynoparam()} should return 733, but did not."); - TestUtil.closeQuietly(cs); - } - -@@ -1107,7 +1104,7 @@ public class Jdbc3CallableStatementTest extends BaseTest4 { - cs.setInt(1, 5); - cs.registerOutParameter(1, Types.INTEGER); - cs.execute(); -- assertEquals("call inoutprocedure(?) should return 10 (when input param = 5) via the INOUT parameter, but did not.", 10, cs.getInt(1)); -+ assertEquals(10, cs.getInt(1), "call inoutprocedure(?) should return 10 (when input param = 5) via the INOUT parameter, but did not."); - TestUtil.closeQuietly(cs); - } - -diff --git a/src/test/java/org/postgresql/test/jdbc3/ParameterMetaDataTest.java b/src/test/java/org/postgresql/test/jdbc3/ParameterMetaDataTest.java -index b3b86d3..1636187 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/ParameterMetaDataTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/ParameterMetaDataTest.java -@@ -5,17 +5,17 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.ParameterMetaData; - import java.sql.PreparedStatement; -@@ -26,13 +26,13 @@ import java.sql.Types; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class ParameterMetaDataTest extends BaseTest4 { - public ParameterMetaDataTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -44,8 +44,7 @@ public class ParameterMetaDataTest extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("simple protocol only does not support describe statement requests", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "simple protocol only does not support describe statement requests"); - TestUtil.createTable(con, "parametertest", - "a int4, b float8, c text, d point, e timestamp with time zone"); - } -diff --git a/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java b/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java -index 07c85c3..dcd95b5 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java -@@ -5,9 +5,10 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.PGProperty; - import org.postgresql.core.ServerVersion; -@@ -16,8 +17,8 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.BeforeClass; --import org.junit.Test; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.Connection; -@@ -27,7 +28,7 @@ import java.sql.Statement; - import java.util.Properties; - - public class ProcedureTransactionTest extends BaseTest4 { -- @BeforeClass -+ @BeforeAll - public static void beforeClass() throws Exception { - try (Connection con = TestUtil.openDB()) { - assumeCallableStatementsSupported(con); -@@ -82,7 +83,7 @@ public class ProcedureTransactionTest extends BaseTest4 { - ResultSet rs = cs.executeQuery(); - - assertTrue(rs.next()); -- assertTrue(rs.getInt(1) == val); -+ assertEquals(val, rs.getInt(1)); - - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(cs); -@@ -102,7 +103,7 @@ public class ProcedureTransactionTest extends BaseTest4 { - ResultSet rs = cs.executeQuery(); - - assertTrue(rs.next()); -- assertTrue(rs.getInt(1) == val); -+ assertEquals(val, rs.getInt(1)); - - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(cs); -@@ -164,7 +165,7 @@ public class ProcedureTransactionTest extends BaseTest4 { - ResultSet rs = cs.executeQuery(); - - assertTrue(rs.next()); -- assertTrue(rs.getInt(1) == val); -+ assertEquals(val, rs.getInt(1)); - - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(cs); -diff --git a/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java b/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java -index 96034c9..4b06b98 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java -@@ -9,9 +9,7 @@ import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.After; --import org.junit.Before; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.SQLException; - import java.sql.Statement; -@@ -26,7 +24,7 @@ public class SendRecvBufferSizeTest extends BaseTest4 { - PGProperty.RECEIVE_BUFFER_SIZE.set(props, "1024"); - } - -- @Before -+ @Override - public void setUp() throws Exception { - super.setUp(); - TestUtil.createTable(con, "hold", "a int"); -@@ -36,7 +34,7 @@ public class SendRecvBufferSizeTest extends BaseTest4 { - stmt.close(); - } - -- @After -+ @Override - public void tearDown() throws SQLException { - TestUtil.dropTable(con, "hold"); - super.tearDown(); -diff --git a/src/test/java/org/postgresql/test/jdbc3/StringTypeParameterTest.java b/src/test/java/org/postgresql/test/jdbc3/StringTypeParameterTest.java -index 569031a..1ebd0e7 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/StringTypeParameterTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/StringTypeParameterTest.java -@@ -5,9 +5,11 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeFalse; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.PreferQueryMode; -@@ -15,10 +17,9 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -28,7 +29,8 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.Properties; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "stringType = {0}") -+@MethodSource("data") - public class StringTypeParameterTest extends BaseTest4 { - private static final String UNSPECIFIED_STRING_TYPE = "unspecified"; - -@@ -42,7 +44,7 @@ public class StringTypeParameterTest extends BaseTest4 { - public void setUp() throws Exception { - super.setUp(); - // Assume enum supported -- Assume.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); - TestUtil.createEnumType(con, "mood", "'happy', 'sad'"); - TestUtil.createTable(con, "stringtypetest", "m mood"); - } -@@ -62,7 +64,6 @@ public class StringTypeParameterTest extends BaseTest4 { - super.tearDown(); - } - -- @Parameterized.Parameters(name = "stringType = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (String stringType : new String[]{null, "varchar", UNSPECIFIED_STRING_TYPE}) { -@@ -73,8 +74,8 @@ public class StringTypeParameterTest extends BaseTest4 { - - @Test - public void testVarcharAsEnum() throws Exception { -- Assume.assumeFalse(UNSPECIFIED_STRING_TYPE.equals(stringType)); -- Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeFalse(UNSPECIFIED_STRING_TYPE.equals(stringType)); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); - - PreparedStatement update = con.prepareStatement("insert into stringtypetest (m) values (?)"); - for (int i = 0; i < 2; i++) { -@@ -110,8 +111,8 @@ public class StringTypeParameterTest extends BaseTest4 { - - @Test - public void testMultipleEnumBinds() throws Exception { -- Assume.assumeFalse(UNSPECIFIED_STRING_TYPE.equals(stringType)); -- Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeFalse(UNSPECIFIED_STRING_TYPE.equals(stringType)); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE); - - PreparedStatement query = - con.prepareStatement("select * from stringtypetest where m = ? or m = ?"); -@@ -132,7 +133,7 @@ public class StringTypeParameterTest extends BaseTest4 { - - @Test - public void testParameterUnspecified() throws Exception { -- Assume.assumeTrue(UNSPECIFIED_STRING_TYPE.equals(stringType)); -+ assumeTrue(UNSPECIFIED_STRING_TYPE.equals(stringType)); - - PreparedStatement update = con.prepareStatement("insert into stringtypetest (m) values (?)"); - update.setString(1, "happy"); -diff --git a/src/test/java/org/postgresql/test/jdbc3/TestReturning.java b/src/test/java/org/postgresql/test/jdbc3/TestReturning.java -deleted file mode 100644 -index 056fb64..0000000 ---- a/src/test/java/org/postgresql/test/jdbc3/TestReturning.java -+++ /dev/null -@@ -1,124 +0,0 @@ --/* -- * Copyright (c) 2021, PostgreSQL Global Development Group -- * See the LICENSE file in the project root for more information. -- */ -- --package org.postgresql.test.jdbc3; -- --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -- --import org.postgresql.PGProperty; --import org.postgresql.test.TestUtil; --import org.postgresql.test.jdbc2.BaseTest4; -- --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -- --import java.sql.Connection; --import java.sql.PreparedStatement; --import java.sql.ResultSet; --import java.sql.SQLException; --import java.util.ArrayList; --import java.util.Collection; --import java.util.Properties; -- --@RunWith(Parameterized.class) --public class TestReturning extends BaseTest4 { -- -- public enum ColumnsReturned { -- Id("Id"), -- id("id"), -- ID("*"), -- QUOTED("\"Id\""), -- NO(); -- -- final String[] columns; -- -- ColumnsReturned(String... columns) { -- this.columns = columns; -- } -- -- public int columnsReturned() { -- if (columns.length == 1 && columns[0].charAt(0) == '*') { -- return 100500; // does not matter much, the meaning is "every possible column" -- } -- return columns.length; -- } -- -- public String[] getColumnNames() { -- if (columnsReturned() == 0) { -- return new String[]{}; -- } -- -- return columns; -- } -- } -- -- static String []returningOptions = {"true", "false"}; -- -- @Parameterized.Parameters(name = "returningInQuery = {0}, quoteReturning = {1}") -- public static Iterable data() { -- Collection ids = new ArrayList<>(); -- for (ColumnsReturned columnsReturned : ColumnsReturned.values()) { -- for (String q : returningOptions) { -- ids.add(new Object[]{columnsReturned, q}); -- } -- } -- return ids; -- } -- -- private final ColumnsReturned columnsReturned; -- private final String quoteReturning; -- -- public TestReturning(ColumnsReturned columnsReturned, String quoteReturning) throws Exception { -- this.columnsReturned = columnsReturned; -- this.quoteReturning = quoteReturning; -- } -- -- protected void updateProperties(Properties props) { -- PGProperty.QUOTE_RETURNING_IDENTIFIERS.set(props, quoteReturning); -- } -- -- @Override -- public void setUp() throws Exception { -- super.setUp(); -- TestUtil.createTempTable(con, "genkeys", "\"Id\" serial, b varchar(5), c int"); -- } -- -- @Override -- public void tearDown() throws SQLException { -- TestUtil.dropTable(con, "genkeys"); -- super.tearDown(); -- } -- -- private static void testGeneratedKeys(Connection conn, String sql, String[] columnNames, boolean exceptionExpected) throws SQLException { -- -- try (PreparedStatement stmt = conn.prepareStatement(sql, columnNames)) { -- stmt.execute(); -- ResultSet rs = stmt.getGeneratedKeys(); -- assertNotNull(rs); -- assertTrue(rs.next()); -- assertEquals(1, rs.getInt(1)); -- } catch (SQLException e) { -- if ( !exceptionExpected ) { -- fail("error getting column names: " + e.getMessage()); -- } -- } -- } -- -- @Test -- public void testMixedCase() throws SQLException { -- -- String insertSql = "INSERT INTO genkeys (b,c) VALUES ('hello', 1)"; -- -- testGeneratedKeys(con, insertSql, new String[]{"Id"}, "false".equals(quoteReturning)); -- testGeneratedKeys(con, insertSql, new String[]{"id"}, true); -- testGeneratedKeys(con, insertSql, new String[]{"ID"}, true); -- testGeneratedKeys(con, insertSql, new String[]{"\"Id\""}, "true".equals(quoteReturning)); -- testGeneratedKeys(con, insertSql, new String[]{"bad"}, true); -- } --} -diff --git a/src/test/java/org/postgresql/test/jdbc3/TypesTest.java b/src/test/java/org/postgresql/test/jdbc3/TypesTest.java -index f1bb91e..b3cd00e 100644 ---- a/src/test/java/org/postgresql/test/jdbc3/TypesTest.java -+++ b/src/test/java/org/postgresql/test/jdbc3/TypesTest.java -@@ -5,15 +5,15 @@ - - package org.postgresql.test.jdbc3; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.Connection; -@@ -54,7 +54,7 @@ public class TypesTest extends BaseTest4 { - pstmt.setObject(4, Boolean.FALSE); - ResultSet rs = pstmt.executeQuery(); - assertTrue(rs.next()); -- assertTrue(!rs.getBoolean(1)); -+ assertFalse(rs.getBoolean(1)); - assertTrue(rs.wasNull()); - assertNull(rs.getObject(2)); - assertTrue(rs.getBoolean(3)); -@@ -62,7 +62,7 @@ public class TypesTest extends BaseTest4 { - // The V2 path will return a String because it doesn't know - // any better. - if (preferQueryMode != PreferQueryMode.SIMPLE) { -- assertTrue(!((Boolean) rs.getObject(4)).booleanValue()); -+ assertFalse(((Boolean) rs.getObject(4)).booleanValue()); - } - } - -@@ -88,7 +88,7 @@ public class TypesTest extends BaseTest4 { - cs.registerOutParameter(1, Types.BOOLEAN); - cs.setBoolean(2, true); - cs.execute(); -- assertEquals(true, cs.getBoolean(1)); -+ assertTrue(cs.getBoolean(1)); - cs.close(); - } - -@@ -98,8 +98,8 @@ public class TypesTest extends BaseTest4 { - - ResultSet rs = stmt.executeQuery("select 'foo1' as icon1, 'foo2' as icon2 "); - assertTrue(rs.next()); -- assertEquals("failed", "foo1", rs.getString("icon1")); -- assertEquals("failed", "foo2", rs.getString("icon2")); -+ assertEquals("foo1", rs.getString("icon1"), "failed"); -+ assertEquals("foo2", rs.getString("icon2"), "failed"); - } - - } -diff --git a/src/test/java/org/postgresql/test/jdbc4/ArrayTest.java b/src/test/java/org/postgresql/test/jdbc4/ArrayTest.java -index db1db95..45ad184 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/ArrayTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/ArrayTest.java -@@ -5,9 +5,15 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertArrayEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.geometric.PGbox; -@@ -20,11 +26,9 @@ import org.postgresql.util.PGobject; - import org.postgresql.util.PGtokenizer; - - import org.hamcrest.MatcherAssert; --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Array; - import java.sql.Connection; -@@ -38,7 +42,8 @@ import java.util.Arrays; - import java.util.Collection; - import java.util.UUID; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class ArrayTest extends BaseTest4 { - - private Connection conn; -@@ -47,7 +52,6 @@ public class ArrayTest extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -89,14 +93,14 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.unwrap(PgConnection.class).createArrayOf("boolean", new boolean[]{true, true, false})); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Boolean[] out = (Boolean[]) arr.getArray(); - -- Assert.assertEquals(3, out.length); -- Assert.assertEquals(Boolean.TRUE, out[0]); -- Assert.assertEquals(Boolean.TRUE, out[1]); -- Assert.assertEquals(Boolean.FALSE, out[2]); -+ assertEquals(3, out.length); -+ assertEquals(Boolean.TRUE, out[0]); -+ assertEquals(Boolean.TRUE, out[1]); -+ assertEquals(Boolean.FALSE, out[2]); - } - - @Test -@@ -109,14 +113,14 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("int4", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Integer[] out = (Integer[]) arr.getArray(); - -- Assert.assertEquals(3, out.length); -- Assert.assertEquals(0, out[0].intValue()); -- Assert.assertEquals(-1, out[1].intValue()); -- Assert.assertEquals(2, out[2].intValue()); -+ assertEquals(3, out.length); -+ assertEquals(0, out[0].intValue()); -+ assertEquals(-1, out[1].intValue()); -+ assertEquals(2, out[2].intValue()); - } - - @Test -@@ -128,29 +132,29 @@ public class ArrayTest extends BaseTest4 { - - byte[][] inCopy = (byte[][]) createdArray.getArray(); - -- Assert.assertEquals(4, inCopy.length); -+ assertEquals(4, inCopy.length); - -- Assert.assertArrayEquals(in[0], inCopy[0]); -- Assert.assertArrayEquals(in[1], inCopy[1]); -- Assert.assertArrayEquals(in[2], inCopy[2]); -- Assert.assertArrayEquals(in[3], inCopy[3]); -- Assert.assertNull(inCopy[3]); -+ assertArrayEquals(in[0], inCopy[0]); -+ assertArrayEquals(in[1], inCopy[1]); -+ assertArrayEquals(in[2], inCopy[2]); -+ assertArrayEquals(in[3], inCopy[3]); -+ assertNull(inCopy[3]); - - pstmt.setArray(1, createdArray); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - - byte[][] out = (byte[][]) arr.getArray(); - -- Assert.assertEquals(4, out.length); -+ assertEquals(4, out.length); - -- Assert.assertArrayEquals(in[0], out[0]); -- Assert.assertArrayEquals(in[1], out[1]); -- Assert.assertArrayEquals(in[2], out[2]); -- Assert.assertArrayEquals(in[3], out[3]); -- Assert.assertNull(out[3]); -+ assertArrayEquals(in[0], out[0]); -+ assertArrayEquals(in[1], out[1]); -+ assertArrayEquals(in[2], out[2]); -+ assertArrayEquals(in[3], out[3]); -+ assertNull(out[3]); - } - - @Test -@@ -165,18 +169,18 @@ public class ArrayTest extends BaseTest4 { - pstmt.setString(1, "{\"\\\\x01ff12\",\"\\\\x\",\"\\\\xace4\",NULL}"); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - - byte[][] out = (byte[][]) arr.getArray(); - -- Assert.assertEquals(4, out.length); -+ assertEquals(4, out.length); - -- Assert.assertArrayEquals(in[0], out[0]); -- Assert.assertArrayEquals(in[1], out[1]); -- Assert.assertArrayEquals(in[2], out[2]); -- Assert.assertArrayEquals(in[3], out[3]); -- Assert.assertNull(out[3]); -+ assertArrayEquals(in[0], out[0]); -+ assertArrayEquals(in[1], out[1]); -+ assertArrayEquals(in[2], out[2]); -+ assertArrayEquals(in[3], out[3]); -+ assertNull(out[3]); - } - - @Test -@@ -189,14 +193,14 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("int2", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Short[] out = (Short[]) arr.getArray(); - -- Assert.assertEquals(3, out.length); -- Assert.assertEquals(0, out[0].shortValue()); -- Assert.assertEquals(-1, out[1].shortValue()); -- Assert.assertEquals(2, out[2].shortValue()); -+ assertEquals(3, out.length); -+ assertEquals(0, out[0].shortValue()); -+ assertEquals(-1, out[1].shortValue()); -+ assertEquals(2, out[2].shortValue()); - } - - @Test -@@ -210,16 +214,16 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("text", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - String[][] out = (String[][]) arr.getArray(); - -- Assert.assertEquals(2, out.length); -- Assert.assertEquals(2, out[0].length); -- Assert.assertEquals("a", out[0][0]); -- Assert.assertEquals("", out[0][1]); -- Assert.assertEquals("\\", out[1][0]); -- Assert.assertEquals("\"\\'z", out[1][1]); -+ assertEquals(2, out.length); -+ assertEquals(2, out[0].length); -+ assertEquals("a", out[0][0]); -+ assertEquals("", out[0][1]); -+ assertEquals("\\", out[1][0]); -+ assertEquals("\"\\'z", out[1][1]); - } - - @Test -@@ -239,14 +243,14 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("json", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - ResultSet arrRs = arr.getResultSet(); -- Assert.assertTrue(arrRs.next()); -- Assert.assertEquals(in[0], arrRs.getObject(2)); -+ assertTrue(arrRs.next()); -+ assertEquals(in[0], arrRs.getObject(2)); - -- Assert.assertTrue(arrRs.next()); -- Assert.assertEquals(in[1], arrRs.getObject(2)); -+ assertTrue(arrRs.next()); -+ assertEquals(in[1], arrRs.getObject(2)); - } - - @Test -@@ -258,14 +262,14 @@ public class ArrayTest extends BaseTest4 { - PreparedStatement pstmt = conn.prepareStatement("SELECT ?::box[]"); - pstmt.setArray(1, conn.createArrayOf("box", in)); - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - ResultSet arrRs = arr.getResultSet(); -- Assert.assertTrue(arrRs.next()); -- Assert.assertEquals(in[0], arrRs.getObject(2)); -- Assert.assertTrue(arrRs.next()); -- Assert.assertEquals(in[1], arrRs.getObject(2)); -- Assert.assertFalse(arrRs.next()); -+ assertTrue(arrRs.next()); -+ assertEquals(in[0], arrRs.getObject(2)); -+ assertTrue(arrRs.next()); -+ assertEquals(in[1], arrRs.getObject(2)); -+ assertFalse(arrRs.next()); - } - - @Test -@@ -283,13 +287,13 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("int8", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Long[] out = (Long[]) arr.getArray(); - -- Assert.assertEquals(2, out.length); -- Assert.assertNull(out[0]); -- Assert.assertNull(out[1]); -+ assertEquals(2, out.length); -+ assertNull(out[0]); -+ assertNull(out[1]); - } - - @Test -@@ -299,14 +303,14 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, conn.createArrayOf("integer", in)); - - ResultSet rs = pstmt.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - Integer[] out = (Integer[]) arr.getArray(); - -- Assert.assertEquals(0, out.length); -+ assertEquals(0, out.length); - - ResultSet arrRs = arr.getResultSet(); -- Assert.assertFalse(arrRs.next()); -+ assertFalse(arrRs.next()); - } - - @Test -@@ -320,12 +324,12 @@ public class ArrayTest extends BaseTest4 { - Array arr = conn.createArrayOf("varchar", in); - String[][] out = (String[][]) arr.getArray(); - -- Assert.assertEquals(2, out.length); -- Assert.assertEquals(2, out[0].length); -- Assert.assertEquals("a", out[0][0]); -- Assert.assertEquals("", out[0][1]); -- Assert.assertEquals("\\", out[1][0]); -- Assert.assertEquals("\"\\'z", out[1][1]); -+ assertEquals(2, out.length); -+ assertEquals(2, out[0].length); -+ assertEquals("a", out[0][0]); -+ assertEquals("", out[0][1]); -+ assertEquals("\\", out[1][0]); -+ assertEquals("\"\\'z", out[1][1]); - } - - @Test -@@ -339,20 +343,18 @@ public class ArrayTest extends BaseTest4 { - Array arr = conn.createArrayOf("float8", in); - Double[][] out = (Double[][]) arr.getArray(); - -- Assert.assertEquals(2, out.length); -- Assert.assertEquals(2, out[0].length); -- Assert.assertEquals(3.5, out[0][0], 0.00001); -- Assert.assertEquals(-4.5, out[0][1], 0.00001); -- Assert.assertEquals(10.0 / 3, out[1][0], 0.00001); -- Assert.assertEquals(77, out[1][1], 0.00001); -+ assertEquals(2, out.length); -+ assertEquals(2, out[0].length); -+ assertEquals(3.5, out[0][0], 0.00001); -+ assertEquals(-4.5, out[0][1], 0.00001); -+ assertEquals(10.0 / 3, out[1][0], 0.00001); -+ assertEquals(77, out[1][1], 0.00001); - } - - @Test - public void testUUIDArray() throws SQLException { -- Assume.assumeTrue("UUID is not supported in PreferQueryMode.SIMPLE", -- preferQueryMode != PreferQueryMode.SIMPLE); -- Assume.assumeTrue("UUID requires PostgreSQL 8.3+", -- TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3)); -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, "UUID is not supported in PreferQueryMode.SIMPLE"); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3), "UUID requires PostgreSQL 8.3+"); - UUID uuid1 = UUID.randomUUID(); - UUID uuid2 = UUID.randomUUID(); - UUID uuid3 = UUID.randomUUID(); -@@ -366,14 +368,14 @@ public class ArrayTest extends BaseTest4 { - conn.prepareStatement("SELECT uuidarr FROM arrtest WHERE uuidarr @> ?"); - pstmt2.setObject(1, conn.createArrayOf("uuid", new UUID[]{uuid1}), Types.OTHER); - ResultSet rs = pstmt2.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Array arr = rs.getArray(1); - UUID[] out = (UUID[]) arr.getArray(); - -- Assert.assertEquals(3, out.length); -- Assert.assertEquals(uuid1, out[0]); -- Assert.assertEquals(uuid2, out[1]); -- Assert.assertEquals(uuid3, out[2]); -+ assertEquals(3, out.length); -+ assertEquals(uuid1, out[0]); -+ assertEquals(uuid2, out[1]); -+ assertEquals(uuid3, out[2]); - - // concatenate a uuid, and check - UUID uuid4 = UUID.randomUUID(); -@@ -386,15 +388,15 @@ public class ArrayTest extends BaseTest4 { - // -- - pstmt2.setObject(1, conn.createArrayOf("uuid", new UUID[]{uuid4}), Types.OTHER); - rs = pstmt2.executeQuery(); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - arr = rs.getArray(1); - out = (UUID[]) arr.getArray(); - -- Assert.assertEquals(4, out.length); -- Assert.assertEquals(uuid1, out[0]); -- Assert.assertEquals(uuid2, out[1]); -- Assert.assertEquals(uuid3, out[2]); -- Assert.assertEquals(uuid4, out[3]); -+ assertEquals(4, out.length); -+ assertEquals(uuid1, out[0]); -+ assertEquals(uuid2, out[1]); -+ assertEquals(uuid3, out[2]); -+ assertEquals(uuid4, out[3]); - } - - @Test -@@ -408,7 +410,7 @@ public class ArrayTest extends BaseTest4 { - try { - pstmt.setObject(1, objCopy, Types.ARRAY); - pstmt.executeUpdate(); -- Assert.fail("setObject() with a Java array parameter and Types.ARRAY shouldn't succeed"); -+ fail("setObject() with a Java array parameter and Types.ARRAY shouldn't succeed"); - } catch (org.postgresql.util.PSQLException ex) { - // Expected failure. - } -@@ -416,7 +418,7 @@ public class ArrayTest extends BaseTest4 { - try { - pstmt.setObject(1, objCopy); - pstmt.executeUpdate(); -- Assert.fail("setObject() with a Java array parameter and no Types argument shouldn't succeed"); -+ fail("setObject() with a Java array parameter and no Types argument shouldn't succeed"); - } catch (org.postgresql.util.PSQLException ex) { - // Expected failure. - } -@@ -438,8 +440,7 @@ public class ArrayTest extends BaseTest4 { - - @Test - public void testGetArrayOfComposites() throws SQLException { -- Assume.assumeTrue("array_agg(expression) requires PostgreSQL 8.4+", -- TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_4)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_4), "array_agg(expression) requires PostgreSQL 8.4+"); - - PreparedStatement insertParentPstmt = - conn.prepareStatement("INSERT INTO arrcompprnttest (name) " -@@ -482,7 +483,7 @@ public class ArrayTest extends BaseTest4 { - ResultSet rs = pstmt.executeQuery(); - - assertNotNull(rs); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - - Array childrenArray = rs.getArray("children"); - assertNotNull(childrenArray); -@@ -497,17 +498,16 @@ public class ArrayTest extends BaseTest4 { - int childID = Integer.parseInt(token.getToken(0)); - // remove double quotes escaping with double quotes - String value = token.getToken(2).replace("\"\"", "\""); -- Assert.assertEquals(children[childID - 1], value); -+ assertEquals(children[childID - 1], value); - } else { -- Assert.fail("Needs to have 3 tokens"); -+ fail("Needs to have 3 tokens"); - } - } - } - - @Test - public void testCasingComposite() throws SQLException { -- Assume.assumeTrue("Arrays of composite types requires PostgreSQL 8.3+", -- TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3), "Arrays of composite types requires PostgreSQL 8.3+"); - - PGobject cc = new PGobject(); - cc.setType("\"CorrectCasing\""); -@@ -520,12 +520,12 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, arr); - ResultSet rs = pstmt.executeQuery(); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Object[] resArr = (Object[]) rs.getArray(1).getArray(); - -- Assert.assertTrue(resArr[0] instanceof PGobject); -+ assertInstanceOf(PGobject.class, resArr[0]); - PGobject resObj = (PGobject) resArr[0]; -- Assert.assertEquals("(1)", resObj.getValue()); -+ assertEquals("(1)", resObj.getValue()); - } - - @Test -@@ -535,10 +535,10 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, arr); - ResultSet rs = pstmt.executeQuery(); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Integer[] resArr = (Integer[]) rs.getArray(1).getArray(); - -- Assert.assertArrayEquals(new Integer[]{1, 2, 3}, resArr); -+ assertArrayEquals(new Integer[]{1, 2, 3}, resArr); - } - - @Test -@@ -548,16 +548,15 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, arr); - ResultSet rs = pstmt.executeQuery(); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Integer[] resArr = (Integer[]) rs.getArray(1).getArray(); - -- Assert.assertArrayEquals(new Integer[]{1, 2, 3}, resArr); -+ assertArrayEquals(new Integer[]{1, 2, 3}, resArr); - } - - @Test - public void testEvilCasing() throws SQLException { -- Assume.assumeTrue("Arrays of composite types requires PostgreSQL 8.3+", -- TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v8_3), "Arrays of composite types requires PostgreSQL 8.3+"); - - PGobject cc = new PGobject(); - cc.setType("\"Evil.Table\""); -@@ -570,12 +569,12 @@ public class ArrayTest extends BaseTest4 { - pstmt.setArray(1, arr); - ResultSet rs = pstmt.executeQuery(); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - Object[] resArr = (Object[]) rs.getArray(1).getArray(); - -- Assert.assertTrue(resArr[0] instanceof PGobject); -+ assertInstanceOf(PGobject.class, resArr[0]); - PGobject resObj = (PGobject) resArr[0]; -- Assert.assertEquals("(1)", resObj.getValue()); -+ assertEquals("(1)", resObj.getValue()); - } - - @Test -@@ -636,18 +635,18 @@ public class ArrayTest extends BaseTest4 { - ps.close(); - ps = con.prepareStatement("select floatarr from arrtest"); - ResultSet rs = ps.executeQuery(); -- Assert.assertTrue("arrtest should contain a row", rs.next()); -+ assertTrue(rs.next(), "arrtest should contain a row"); - Array getArray = rs.getArray(1); -- Assert.assertNull("null array should return null value on getArray", getArray); -+ assertNull(getArray, "null array should return null value on getArray"); - Object getObject = rs.getObject(1); -- Assert.assertNull("null array should return null on getObject", getObject); -+ assertNull(getObject, "null array should return null on getObject"); - } - - @Test - public void createNullArray() throws SQLException { - Array arr = con.createArrayOf("float8", null); - assertNotNull(arr); -- Assert.assertNull(arr.getArray()); -+ assertNull(arr.getArray()); - } - - @Test -@@ -666,7 +665,7 @@ public class ArrayTest extends BaseTest4 { - } - // Both {{"1","2"},{"3","4"}} and {{1,2},{3,4}} are the same array representation - stringValue = stringValue.replaceAll("\"", ""); -- Assert.assertEquals("{{1,2},{3,4}}", stringValue); -+ assertEquals("{{1,2},{3,4}}", stringValue); - TestUtil.closeQuietly(rs); - TestUtil.closeQuietly(ps); - } -@@ -686,13 +685,13 @@ public class ArrayTest extends BaseTest4 { - Array array = rs.getArray(1); - Integer[][] secondRowValues = (Integer[][]) array.getArray(2, 1); - -- Assert.assertEquals(3, secondRowValues[0][0].intValue()); -- Assert.assertEquals(4, secondRowValues[0][1].intValue()); -+ assertEquals(3, secondRowValues[0][0].intValue()); -+ assertEquals(4, secondRowValues[0][1].intValue()); - } - - @Test - public void testJsonbArray() throws SQLException { -- Assume.assumeTrue("jsonb requires PostgreSQL 9.4+", TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_4)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_4), "jsonb requires PostgreSQL 9.4+"); - TestUtil.createTempTable(con, "jsonbarray", "jbarray jsonb[]"); - try (Statement stmt = con.createStatement()) { - stmt.executeUpdate("insert into jsonbarray values( ARRAY['{\"a\":\"a\"}'::jsonb, '{\"b\":\"b\"}'::jsonb] )"); -diff --git a/src/test/java/org/postgresql/test/jdbc4/BinaryStreamTest.java b/src/test/java/org/postgresql/test/jdbc4/BinaryStreamTest.java -index 2b4bc79..c366e50 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/BinaryStreamTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/BinaryStreamTest.java -@@ -5,11 +5,12 @@ - - package org.postgresql.test.jdbc4; - -+import static org.junit.jupiter.api.Assertions.assertArrayEquals; -+ - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.ByteArrayInputStream; - import java.nio.ByteBuffer; -@@ -67,7 +68,7 @@ public class BinaryStreamTest extends BaseTest4 { - try { - rs.next(); - byte[] actualData = rs.getBytes(1); -- Assert.assertArrayEquals("Sent and received data are not the same", data, actualData); -+ assertArrayEquals(data, actualData, "Sent and received data are not the same"); - } finally { - rs.close(); - } -diff --git a/src/test/java/org/postgresql/test/jdbc4/BinaryTest.java b/src/test/java/org/postgresql/test/jdbc4/BinaryTest.java -index 4fb7541..9c63f68 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/BinaryTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/BinaryTest.java -@@ -5,7 +5,9 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.PGResultSetMetaData; -@@ -14,8 +16,7 @@ import org.postgresql.core.Field; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -34,8 +35,9 @@ public class BinaryTest extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("Server-prepared statements are not supported in 'simple protocol only'", -- preferQueryMode != PreferQueryMode.SIMPLE); -+ assumeTrue( -+ preferQueryMode != PreferQueryMode.SIMPLE, -+ "Server-prepared statements are not supported in 'simple protocol only'"); - statement = con.prepareStatement("select 1"); - - ((PGStatement) statement).setPrepareThreshold(5); -@@ -123,7 +125,7 @@ public class BinaryTest extends BaseTest4 { - for (int i = 0; i < 10; i++) { - ps.setInt(1, 42 + i); - ResultSet rs = ps.executeQuery(); -- assertEquals("One row should be returned", true, rs.next()); -+ assertTrue(rs.next(), "One row should be returned"); - assertEquals(42 + i, rs.getInt(1)); - rs.close(); - } -diff --git a/src/test/java/org/postgresql/test/jdbc4/CharacterStreamTest.java b/src/test/java/org/postgresql/test/jdbc4/CharacterStreamTest.java -index 6d3ba99..b260033 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/CharacterStreamTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/CharacterStreamTest.java -@@ -5,11 +5,13 @@ - - package org.postgresql.test.jdbc4; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; -+ - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.Reader; - import java.io.StringReader; -@@ -52,7 +54,11 @@ public class CharacterStreamTest extends BaseTest4 { - try { - Reader reader = data != null ? new StringReader(data) : null; - long length = data != null ? data.length() : 0; -- insertPS.setCharacterStream(1, reader, length); -+ try { -+ insertPS.setCharacterStream(1, reader, length); -+ } catch (SQLFeatureNotSupportedException e) { -+ assumeTrue(false, "PreparedStatement.setCharacterStream(int, Reader, long) is not implemented"); -+ } - insertPS.executeUpdate(); - } finally { - TestUtil.closeQuietly(insertPS); -@@ -72,7 +78,7 @@ public class CharacterStreamTest extends BaseTest4 { - - private void validateContent(String data) throws Exception { - String actualData = TestUtil.queryForString(con, _select); -- Assert.assertEquals("Sent and received data are not the same", data, actualData); -+ assertEquals(data, actualData, "Sent and received data are not the same"); - } - - private static String getTestData(int size) { -@@ -101,7 +107,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLengthNull() throws Exception { - String data = null; - insertStreamKnownLongLength(data); -@@ -122,7 +128,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLengthEmpty() throws Exception { - String data = ""; - insertStreamKnownLongLength(data); -@@ -143,7 +149,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLength2Kb() throws Exception { - String data = getTestData(2 * 1024); - insertStreamKnownLongLength(data); -@@ -164,7 +170,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLength10Kb() throws Exception { - String data = getTestData(10 * 1024); - insertStreamKnownLongLength(data); -@@ -185,7 +191,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLength100Kb() throws Exception { - String data = getTestData(100 * 1024); - insertStreamKnownLongLength(data); -@@ -206,7 +212,7 @@ public class CharacterStreamTest extends BaseTest4 { - validateContent(data); - } - -- @Test(expected = SQLFeatureNotSupportedException.class) -+ @Test - public void testKnownLongLength200Kb() throws Exception { - String data = getTestData(200 * 1024); - insertStreamKnownLongLength(data); -diff --git a/src/test/java/org/postgresql/test/jdbc4/ClientInfoTest.java b/src/test/java/org/postgresql/test/jdbc4/ClientInfoTest.java -index 84fb9b6..4276092 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/ClientInfoTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/ClientInfoTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.ResultSet; - import java.sql.SQLClientInfoException; -@@ -57,10 +57,14 @@ public class ClientInfoTest extends BaseTest4 { - Statement s = con.createStatement(); - s.execute("set application_name='" + appName + "'"); - s.close(); -- assertEquals("application_name was set to " + appName + ", and it should be visible via " -- + "con.getClientInfo", appName, con.getClientInfo("ApplicationName")); -- assertEquals("application_name was set to " + appName + ", and it should be visible via " -- + "con.getClientInfo", appName, con.getClientInfo().get("ApplicationName")); -+ assertEquals( -+ appName, -+ con.getClientInfo("ApplicationName"), -+ () -> "set application_name='...' should be visible via con.getClientInfo(\"ApplicationName\")"); -+ assertEquals( -+ appName, -+ con.getClientInfo().get("ApplicationName"), -+ () -> "set application_name='...' should be visible via con.getClientInfo().get(\"ApplicationName\")"); - } - - @Test -diff --git a/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java b/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java -index 8d20b7e..90ea3f9 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java -@@ -12,12 +12,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - import static org.junit.jupiter.api.Assertions.assertFalse; - import static org.junit.jupiter.api.Assertions.assertNotNull; - import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; - -@@ -303,7 +303,7 @@ class DatabaseMetaDataTest { - @Test - void getProceduresInSchemaForProcedures_whenCatalogArgEmpty_expectNoResults() throws SQLException { - // Only run this test for PostgreSQL version 11+; assertions for versions prior would be vacuously true as we don't create a procedure in the setup for older versions -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); - - DatabaseMetaData dbmd = conn.getMetaData(); - -@@ -327,7 +327,7 @@ class DatabaseMetaDataTest { - @Test - void getProceduresWithCorrectCatalogAndWithout() throws SQLException { - // Only run this test for PostgreSQL version 11+; assertions for versions prior would be vacuously true as we don't create a procedure in the setup for older versions -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); - - DatabaseMetaData dbmd = conn.getMetaData(); - try (ResultSet rs = dbmd.getProcedures(null, "hasprocedures", null)) { -@@ -349,7 +349,7 @@ class DatabaseMetaDataTest { - @Test - void getProceduresInSchemaForProcedures() throws SQLException { - // Only run this test for PostgreSQL version 11+; assertions for versions prior would be vacuously true as we don't create a procedure in the setup for older versions -- Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(conn, ServerVersion.v11)); - - DatabaseMetaData dbmd = conn.getMetaData(); - -diff --git a/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java b/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java -index 5be6ad8..f6a5ee6 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java -@@ -5,16 +5,16 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.core.TransactionState; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assume; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.Connection; - import java.sql.SQLException; -@@ -23,7 +23,7 @@ public class IsValidTest extends BaseTest4 { - @Test - public void testIsValidShouldNotModifyTransactionStateOutsideTransaction() throws SQLException { - TransactionState initialTransactionState = TestUtil.getTransactionState(con); -- assertTrue("Connection should be valid", con.isValid(0)); -+ assertTrue(con.isValid(0), "Connection should be valid"); - TestUtil.assertTransactionState("Transaction state should not be modified by non-transactional Connection.isValid(...)", con, initialTransactionState); - } - -@@ -32,7 +32,7 @@ public class IsValidTest extends BaseTest4 { - con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); - con.setAutoCommit(false); - TransactionState transactionState = TestUtil.getTransactionState(con); -- assertTrue("Connection should be valid", con.isValid(0)); -+ assertTrue(con.isValid(0), "Connection should be valid"); - TestUtil.assertTransactionState("Transaction state should not be modified by Connection.isValid(...) within an empty transaction", con, transactionState); - } - -@@ -42,16 +42,16 @@ public class IsValidTest extends BaseTest4 { - con.setAutoCommit(false); - TestUtil.executeQuery(con, "SELECT 1"); - TransactionState transactionState = TestUtil.getTransactionState(con); -- assertTrue("Connection should be valid", con.isValid(0)); -+ assertTrue(con.isValid(0), "Connection should be valid"); - TestUtil.assertTransactionState("Transaction state should not be modified by Connection.isValid(...) within a non-empty transaction", con, transactionState); - } - - @Test - public void testIsValidRemoteClose() throws SQLException, InterruptedException { -- Assume.assumeTrue("Unable to use pg_terminate_backend(...) before version 8.4", TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)); -+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4), "Unable to use pg_terminate_backend(...) before version 8.4"); - - boolean wasTerminated = TestUtil.terminateBackend(con); -- assertTrue("The backend should be terminated", wasTerminated); -+ assertTrue(wasTerminated, "The backend should be terminated"); - - // Keeps checking for up to 5-seconds that the connection is marked invalid - for (int i = 0; i < 500; i++) { -@@ -61,6 +61,6 @@ public class IsValidTest extends BaseTest4 { - // Wait a bit to give the connection a chance to gracefully handle the termination - Thread.sleep(10); - } -- assertFalse("The terminated connection should not be valid", con.isValid(0)); -+ assertFalse(con.isValid(0), "The terminated connection should not be valid"); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc4/JsonbTest.java b/src/test/java/org/postgresql/test/jdbc4/JsonbTest.java -index 6248ed2..cdce1c4 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/JsonbTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/JsonbTest.java -@@ -5,18 +5,17 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Array; - import java.sql.PreparedStatement; -@@ -27,13 +26,13 @@ import java.util.ArrayList; - import java.util.Arrays; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class JsonbTest extends BaseTest4 { - public JsonbTest(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -45,7 +44,9 @@ public class JsonbTest extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("jsonb requires PostgreSQL 9.4+", TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_4)); -+ assumeTrue( -+ TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_4), -+ "jsonb requires PostgreSQL 9.4+"); - TestUtil.createTable(con, "jsonbtest", "detail jsonb"); - Statement stmt = con.createStatement(); - stmt.executeUpdate("INSERT INTO jsonbtest (detail) VALUES ('{\"a\": 1}')"); -@@ -97,17 +98,15 @@ public class JsonbTest extends BaseTest4 { - assertTrue(rs.next()); - Array array = rs.getArray(1); - Object[] objectArray = (Object[]) array.getArray(); -- Assert.assertEquals( -- "'{[2],[3]}'::" + type + "[] should come up as Java array with two entries", -+ assertEquals( - "[[2], [3]]", -- Arrays.deepToString(objectArray) -- ); -+ Arrays.deepToString(objectArray), -+ () -> "'{[2],[3]}'::" + type + "[] should come up as Java array with two entries"); - -- Assert.assertEquals( -- type + " array entries should come up as strings", -+ assertEquals( - arrayElement.getName() + ", " + arrayElement.getName(), -- objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName() -- ); -+ objectArray[0].getClass().getName() + ", " + objectArray[1].getClass().getName(), -+ () -> type + " array entries should come up as strings"); - rs.close(); - stmt.close(); - } -diff --git a/src/test/java/org/postgresql/test/jdbc4/UUIDTest.java b/src/test/java/org/postgresql/test/jdbc4/UUIDTest.java -index 05d834c..6e35e05 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/UUIDTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/UUIDTest.java -@@ -5,8 +5,9 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.core.ServerVersion; - import org.postgresql.jdbc.PreferQueryMode; -@@ -14,10 +15,9 @@ import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -28,7 +28,8 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.UUID; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary={0}, stringType={1}") -+@MethodSource("data") - public class UUIDTest extends BaseTest4 { - - public UUIDTest(BinaryMode binaryMode, StringType stringType) { -@@ -36,7 +37,6 @@ public class UUIDTest extends BaseTest4 { - setStringType(stringType); - } - -- @Parameterized.Parameters(name = "binary={0}, stringType={1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -93,9 +93,8 @@ public class UUIDTest extends BaseTest4 { - try { - ps.executeUpdate(); - if (getStringType() == StringType.VARCHAR && preferQueryMode != PreferQueryMode.SIMPLE) { -- Assert.fail( -- "setString(, uuid) should fail to insert value into UUID column when stringType=varchar." -- + " Expecting error <>"); -+ fail("setString(, uuid) should fail to insert value into UUID column when stringType=varchar." -+ + " Expecting error <>"); - } - } catch (SQLException e) { - if (getStringType() == StringType.VARCHAR -diff --git a/src/test/java/org/postgresql/test/jdbc4/XmlTest.java b/src/test/java/org/postgresql/test/jdbc4/XmlTest.java -index 74a4925..42aaaaf 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/XmlTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/XmlTest.java -@@ -5,16 +5,18 @@ - - package org.postgresql.test.jdbc4; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - import org.w3c.dom.Node; - - import java.io.IOException; -@@ -69,7 +71,7 @@ public class XmlTest extends BaseTest4 { - public void setUp() throws Exception { - super.setUp(); - assumeMinimumServerVersion(ServerVersion.v8_3); -- assumeTrue("Server has been compiled --with-libxml", isXmlEnabled(con)); -+ assumeTrue(isXmlEnabled(con), "Server has been compiled --with-libxml"); - - Statement stmt = con.createStatement(); - stmt.execute("CREATE TEMP TABLE xmltest(id int primary key, val xml)"); -@@ -215,7 +217,7 @@ public class XmlTest extends BaseTest4 { - xml = rs.getSQLXML(1); - assertEquals(header + _xmlDocument, xml.getString()); - -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -301,11 +303,11 @@ public class XmlTest extends BaseTest4 { - ResultSet rs = getRS(); - assertTrue(rs.next()); - Object o = rs.getObject(1); -- assertTrue(o instanceof SQLXML); -+ assertInstanceOf(SQLXML.class, o); - assertEquals(_xmlDocument, ((SQLXML) o).getString()); - assertTrue(rs.next()); - assertEquals(_xmlDocument, rs.getSQLXML(1).getString()); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -@@ -335,7 +337,7 @@ public class XmlTest extends BaseTest4 { - assertNull(rs.getSQLXML(1)); - assertTrue(rs.next()); - assertNull(rs.getSQLXML("val")); -- assertTrue(!rs.next()); -+ assertFalse(rs.next()); - } - - @Test -diff --git a/src/test/java/org/postgresql/test/jdbc4/jdbc41/AbortTest.java b/src/test/java/org/postgresql/test/jdbc4/jdbc41/AbortTest.java -index e619cd9..8354cbd 100644 ---- a/src/test/java/org/postgresql/test/jdbc4/jdbc41/AbortTest.java -+++ b/src/test/java/org/postgresql/test/jdbc4/jdbc41/AbortTest.java -@@ -5,12 +5,13 @@ - - package org.postgresql.test.jdbc4.jdbc41; - --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertThrows; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.SQLException; - import java.sql.Statement; -@@ -89,8 +90,10 @@ public class AbortTest extends BaseTest4 { - * According to the javadoc, calling abort when the {@code executor} is {@code null} - * results in SQLException - */ -- @Test(expected = SQLException.class) -+ @Test - public void abortWithNullExecutor() throws SQLException { -- con.abort(null); -+ assertThrows(SQLException.class, () -> { -+ con.abort(null); -+ }); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java b/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java -index a9666d7..0634e6a 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java -+++ b/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java -@@ -6,6 +6,7 @@ - package org.postgresql.test.jdbc42; - - import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.PGConnection; - import org.postgresql.PGProperty; -@@ -13,7 +14,6 @@ import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.TestUtil; - - import org.junit.jupiter.api.AfterEach; --import org.junit.jupiter.api.Assumptions; - import org.junit.jupiter.api.Test; - - import java.lang.management.ManagementFactory; -@@ -301,7 +301,7 @@ class AdaptiveFetchSizeTest { - PGConnection pgConnection = connection.unwrap(PGConnection.class); - PreferQueryMode preferQueryMode = - pgConnection == null ? PreferQueryMode.EXTENDED : pgConnection.getPreferQueryMode(); -- Assumptions.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, -+ assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE, - "Fetching tests can't be performed in simple mode"); - } - -diff --git a/src/test/java/org/postgresql/test/jdbc42/GetObject310InfinityTests.java b/src/test/java/org/postgresql/test/jdbc42/GetObject310InfinityTests.java -index 87dd142..3e70229 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/GetObject310InfinityTests.java -+++ b/src/test/java/org/postgresql/test/jdbc42/GetObject310InfinityTests.java -@@ -9,11 +9,11 @@ import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; -+import org.junit.jupiter.api.Assumptions; -+import org.junit.jupiter.api.Assertions; - - import java.lang.reflect.Field; - import java.sql.PreparedStatement; -@@ -26,7 +26,8 @@ import java.util.ArrayList; - import java.util.Arrays; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class GetObject310InfinityTests extends BaseTest4 { - private final String expression; - private final String pgType; -@@ -45,11 +46,10 @@ public class GetObject310InfinityTests extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("PostgreSQL 8.3 does not support 'infinity' for 'date'", -- !"date".equals(pgType) || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)); -+ Assumptions.assumeTrue(!"date".equals(pgType) || TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4), -+ () -> "PostgreSQL 8.3 does not support 'infinity' for 'date'"); - } - -- @Parameterized.Parameters(name = "binary = {0}, expr = {1}, pgType = {2}, klass = {3}") - public static Iterable data() throws IllegalAccessException { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -92,6 +92,6 @@ public class GetObject310InfinityTests extends BaseTest4 { - ResultSet rs = stmt.executeQuery(); - rs.next(); - Object res = rs.getObject(1, klass); -- Assert.assertEquals(expectedValue, res); -+ Assertions.assertEquals(expectedValue, res); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java b/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java -index 162e49a..2203d2a 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java -+++ b/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java -@@ -5,12 +5,12 @@ - - package org.postgresql.test.jdbc42; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertFalse; --import static org.junit.Assert.assertNull; --import static org.junit.Assert.assertThrows; --import static org.junit.Assert.assertTrue; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertNull; -+import static org.junit.jupiter.api.Assertions.assertThrows; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; -@@ -18,9 +18,9 @@ import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLException; - import org.postgresql.util.PSQLState; - --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -45,7 +45,8 @@ import java.util.TimeZone; - import java.util.stream.Collectors; - import java.util.stream.Stream; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class GetObject310Test extends BaseTest4 { - - private static final TimeZone saveTZ = TimeZone.getDefault(); -@@ -61,7 +62,6 @@ public class GetObject310Test extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -diff --git a/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java b/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java -index 6a55c75..4041525 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java -+++ b/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java -@@ -5,12 +5,12 @@ - - package org.postgresql.test.jdbc42; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.sql.CallableStatement; - import java.sql.ResultSet; -diff --git a/src/test/java/org/postgresql/test/jdbc42/LargeCountJdbc42Test.java b/src/test/java/org/postgresql/test/jdbc42/LargeCountJdbc42Test.java -index fef3362..d5fb25c 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/LargeCountJdbc42Test.java -+++ b/src/test/java/org/postgresql/test/jdbc42/LargeCountJdbc42Test.java -@@ -5,16 +5,21 @@ - - package org.postgresql.test.jdbc42; - -+import static org.junit.jupiter.api.Assertions.assertArrayEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertFalse; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; -+ - import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Ignore; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Disabled; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.PreparedStatement; - import java.sql.SQLException; -@@ -27,7 +32,8 @@ import java.util.Properties; - * Test methods with small counts that return long and failure scenarios. This have two really big - * and slow test, they are ignored for CI but can be tested locally to check that it works. - */ --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}, insertRewrite = {1}") -+@MethodSource("data") - public class LargeCountJdbc42Test extends BaseTest4 { - - private final boolean insertRewrite; -@@ -37,7 +43,6 @@ public class LargeCountJdbc42Test extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}, insertRewrite = {1}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BinaryMode binaryMode : BinaryMode.values()) { -@@ -92,7 +97,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - /* - * Test PreparedStatement.executeLargeUpdate() and Statement.executeLargeUpdate(String sql) - */ -- @Ignore("This is the big and SLOW test") -+ @Disabled("This is the big and SLOW test") - @Test - public void testExecuteLargeUpdateBIG() throws Exception { - long expected = Integer.MAX_VALUE + 110L; -@@ -103,12 +108,12 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setLong(1, 1); - stmt.setLong(2, 2_147_483_757L); // Integer.MAX_VALUE + 110L - long count = stmt.executeLargeUpdate(); -- Assert.assertEquals("PreparedStatement 110 rows more than Integer.MAX_VALUE", expected, count); -+ assertEquals(expected, count, "PreparedStatement 110 rows more than Integer.MAX_VALUE"); - } - // Test Statement.executeLargeUpdate(String sql) - try (Statement stmt = con.createStatement()) { - long count = stmt.executeLargeUpdate("delete from largetable"); -- Assert.assertEquals("Statement 110 rows more than Integer.MAX_VALUE", expected, count); -+ assertEquals(expected, count, "Statement 110 rows more than Integer.MAX_VALUE"); - } - con.setAutoCommit(true); - } -@@ -122,7 +127,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - long count = stmt.executeLargeUpdate("insert into largetable " - + "select true from generate_series(1, 1010)"); - long expected = 1010L; -- Assert.assertEquals("Small long return 1010L", expected, count); -+ assertEquals(expected, count, "Small long return 1010L"); - } - } - -@@ -137,7 +142,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setLong(2, 1010L); - long count = stmt.executeLargeUpdate(); - long expected = 1010L; -- Assert.assertEquals("Small long return 1010L", expected, count); -+ assertEquals(expected, count, "Small long return 1010L"); - } - } - -@@ -149,10 +154,10 @@ public class LargeCountJdbc42Test extends BaseTest4 { - try (Statement stmt = con.createStatement()) { - boolean isResult = stmt.execute("insert into largetable " - + "select true from generate_series(1, 1010)"); -- Assert.assertFalse("False if it is an update count or there are no results", isResult); -+ assertFalse(isResult, "False if it is an update count or there are no results"); - long count = stmt.getLargeUpdateCount(); - long expected = 1010L; -- Assert.assertEquals("Small long return 1010L", expected, count); -+ assertEquals(expected, count, "Small long return 1010L"); - } - } - -@@ -166,10 +171,10 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setInt(1, 1); - stmt.setInt(2, 1010); - boolean isResult = stmt.execute(); -- Assert.assertFalse("False if it is an update count or there are no results", isResult); -+ assertFalse(isResult, "False if it is an update count or there are no results"); - long count = stmt.getLargeUpdateCount(); - long expected = 1010L; -- Assert.assertEquals("Small long return 1010L", expected, count); -+ assertEquals(expected, count, "Small long return 1010L"); - } - } - -@@ -180,9 +185,9 @@ public class LargeCountJdbc42Test extends BaseTest4 { - public void testExecuteLargeUpdateStatementSELECT() throws Exception { - try (Statement stmt = con.createStatement()) { - long count = stmt.executeLargeUpdate("select true from generate_series(1, 5)"); -- Assert.fail("A result was returned when none was expected. Returned: " + count); -+ fail("A result was returned when none was expected. Returned: " + count); - } catch (SQLException e) { -- Assert.assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); -+ assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); - } - } - -@@ -195,9 +200,9 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setLong(1, 1); - stmt.setLong(2, 5L); - long count = stmt.executeLargeUpdate(); -- Assert.fail("A result was returned when none was expected. Returned: " + count); -+ fail("A result was returned when none was expected. Returned: " + count); - } catch (SQLException e) { -- Assert.assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); -+ assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); - } - } - -@@ -208,10 +213,10 @@ public class LargeCountJdbc42Test extends BaseTest4 { - public void testGetLargeUpdateCountStatementSELECT() throws Exception { - try (Statement stmt = con.createStatement()) { - boolean isResult = stmt.execute("select true from generate_series(1, 5)"); -- Assert.assertTrue("True since this is a SELECT", isResult); -+ assertTrue(isResult, "True since this is a SELECT"); - long count = stmt.getLargeUpdateCount(); - long expected = -1L; -- Assert.assertEquals("-1 if the current result is a ResultSet object", expected, count); -+ assertEquals(expected, count, "-1 if the current result is a ResultSet object"); - } - } - -@@ -224,10 +229,10 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setLong(1, 1); - stmt.setLong(2, 5L); - boolean isResult = stmt.execute(); -- Assert.assertTrue("True since this is a SELECT", isResult); -+ assertTrue(isResult, "True since this is a SELECT"); - long count = stmt.getLargeUpdateCount(); - long expected = -1L; -- Assert.assertEquals("-1 if the current result is a ResultSet object", expected, count); -+ assertEquals(expected, count, "-1 if the current result is a ResultSet object"); - } - } - -@@ -262,7 +267,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - /* - * Test simple PreparedStatement.executeLargeBatch(); - */ -- @Ignore("This is the big and SLOW test") -+ @Disabled("This is the big and SLOW test") - @Test - public void testExecuteLargeBatchStatementBIG() throws Exception { - con.setAutoCommit(false); -@@ -278,7 +283,10 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.setInt(2, 50); - stmt.addBatch(); // statement three - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("Large rows inserted via 3 batch", new long[]{200L, 3_000_000_000L, 50L}, actual); -+ assertArrayEquals( -+ new long[]{200L, 3_000_000_000L, 50L}, -+ actual, -+ "Large rows inserted via 3 batch"); - } - con.setAutoCommit(true); - } -@@ -294,7 +302,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch("insert into largetable(a) values(true)"); // statement three - stmt.addBatch("insert into largetable values(false)"); // statement four - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("Rows inserted via 4 batch", new long[]{1L, 1L, 1L, 1L}, actual); -+ assertArrayEquals(new long[]{1L, 1L, 1L, 1L}, actual, "Rows inserted via 4 batch"); - } - } - -@@ -316,7 +324,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch(); // statement three - stmt.addBatch(); // statement four, same parms as three - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("Rows inserted via 4 batch", new long[]{200L, 100L, 50L, 50L}, actual); -+ assertArrayEquals(new long[]{200L, 100L, 50L, 50L}, actual, "Rows inserted via 4 batch"); - } - } - -@@ -334,7 +342,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch(); - } - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("Rows inserted via batch", loop, actual); -+ assertArrayEquals(loop, actual, "Rows inserted via batch"); - } - } - -@@ -350,12 +358,12 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch(); - } - long[] actual = stmt.executeLargeBatch(); -- Assert.assertEquals("Rows inserted via batch", loop.length, actual.length); -+ assertEquals(loop.length, actual.length, "Rows inserted via batch"); - for (long i : actual) { - if (insertRewrite) { -- Assert.assertEquals(Statement.SUCCESS_NO_INFO, i); -+ assertEquals(Statement.SUCCESS_NO_INFO, i); - } else { -- Assert.assertEquals(1, i); -+ assertEquals(1, i); - } - } - } -@@ -368,7 +376,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - public void testNullExecuteLargeBatchStatement() throws Exception { - try (Statement stmt = con.createStatement()) { - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("addBatch() not called batchStatements is null", new long[0], actual); -+ assertArrayEquals(new long[0], actual, "addBatch() not called batchStatements is null"); - } - } - -@@ -381,7 +389,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch(""); - stmt.clearBatch(); - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("clearBatch() called, batchStatements.isEmpty()", new long[0], actual); -+ assertArrayEquals(new long[0], actual, "clearBatch() called, batchStatements.isEmpty()"); - } - } - -@@ -392,7 +400,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - public void testNullExecuteLargeBatchPreparedStatement() throws Exception { - try (PreparedStatement stmt = con.prepareStatement("")) { - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("addBatch() not called batchStatements is null", new long[0], actual); -+ assertArrayEquals(new long[0], actual, "addBatch() not called batchStatements is null"); - } - } - -@@ -405,7 +413,7 @@ public class LargeCountJdbc42Test extends BaseTest4 { - stmt.addBatch(); - stmt.clearBatch(); - long[] actual = stmt.executeLargeBatch(); -- Assert.assertArrayEquals("clearBatch() called, batchStatements.isEmpty()", new long[0], actual); -+ assertArrayEquals(new long[0], actual, "clearBatch() called, batchStatements.isEmpty()"); - } - } - -diff --git a/src/test/java/org/postgresql/test/jdbc42/PreparedStatement64KBindsTest.java b/src/test/java/org/postgresql/test/jdbc42/PreparedStatement64KBindsTest.java -index 8f3fb3a..c8f1407 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/PreparedStatement64KBindsTest.java -+++ b/src/test/java/org/postgresql/test/jdbc42/PreparedStatement64KBindsTest.java -@@ -5,15 +5,17 @@ - - package org.postgresql.test.jdbc42; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.fail; -+ - import org.postgresql.PGProperty; - import org.postgresql.jdbc.PreferQueryMode; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.PSQLState; - --import org.junit.Assert; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Array; - import java.sql.PreparedStatement; -@@ -27,7 +29,8 @@ import java.util.Properties; - import java.util.stream.Collectors; - import java.util.stream.IntStream; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "numBinds={0}, preferQueryMode={1}, binaryMode={2}}") -+@MethodSource("data") - public class PreparedStatement64KBindsTest extends BaseTest4 { - private final int numBinds; - private final PreferQueryMode preferQueryMode; -@@ -40,7 +43,6 @@ public class PreparedStatement64KBindsTest extends BaseTest4 { - this.binaryMode = binaryMode; - } - -- @Parameterized.Parameters(name = "numBinds={0}, preferQueryMode={1}, binaryMode={2}}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (PreferQueryMode preferQueryMode : PreferQueryMode.values()) { -@@ -81,17 +83,17 @@ public class PreparedStatement64KBindsTest extends BaseTest4 { - String actual = Arrays.toString(elements); - - if (preferQueryMode == PreferQueryMode.SIMPLE || numBinds <= 65535) { -- Assert.assertEquals("SELECT query with " + numBinds + " should work", actual, expected); -+ assertEquals(actual, expected, () -> "SELECT query with " + numBinds + " should work"); - } else { -- Assert.fail("con.prepareStatement(..." + numBinds + " binds) should fail since the wire protocol allows only 65535 parameters"); -+ fail("con.prepareStatement(..." + numBinds + " binds) should fail since the wire protocol allows only 65535 parameters"); - } - } - } catch (SQLException e) { - if (preferQueryMode != PreferQueryMode.SIMPLE && numBinds > 65535) { -- Assert.assertEquals( -- "con.prepareStatement(..." + numBinds + " binds) should fail since the wire protocol allows only 65535 parameters. SQL State is ", -+ assertEquals( - PSQLState.INVALID_PARAMETER_VALUE.getState(), -- e.getSQLState() -+ e.getSQLState(), -+ () -> "con.prepareStatement(..." + numBinds + " binds) should fail since the wire protocol allows only 65535 parameters. SQL State is " - ); - } else { - throw e; -diff --git a/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java b/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java -index d31e439..a923bb7 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java -+++ b/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java -@@ -5,12 +5,14 @@ - - package org.postgresql.test.jdbc42; - -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ - import org.postgresql.PGProperty; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Assert; --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.math.BigDecimal; - import java.sql.PreparedStatement; -@@ -51,7 +53,7 @@ public class PreparedStatementTest extends BaseTest4 { - BigDecimal d = rs.getBigDecimal(1); - pstmt.close(); - -- Assert.assertEquals(new BigDecimal("3.2"), d); -+ assertEquals(new BigDecimal("3.2"), d); - } - - @Test -@@ -107,12 +109,12 @@ public class PreparedStatementTest extends BaseTest4 { - pstmt.executeUpdate(); - - ResultSet rs = con.createStatement().executeQuery("select tt from timetable order by id asc"); -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - LocalTime localTime = (LocalTime) rs.getObject(1, LocalTime.class); -- Assert.assertEquals(LocalTime.MAX, localTime); -+ assertEquals(LocalTime.MAX, localTime); - -- Assert.assertTrue(rs.next()); -+ assertTrue(rs.next()); - localTime = (LocalTime) rs.getObject(1, LocalTime.class); -- Assert.assertEquals(LocalTime.MIN, localTime); -+ assertEquals(LocalTime.MIN, localTime); - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc42/SetObject310InfinityTests.java b/src/test/java/org/postgresql/test/jdbc42/SetObject310InfinityTests.java -index 86457aa..d991cf3 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/SetObject310InfinityTests.java -+++ b/src/test/java/org/postgresql/test/jdbc42/SetObject310InfinityTests.java -@@ -5,19 +5,18 @@ - - package org.postgresql.test.jdbc42; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.core.ServerVersion; - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.After; --import org.junit.Assume; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; -+import org.junit.jupiter.api.Assumptions; - - import java.sql.PreparedStatement; - import java.sql.ResultSet; -@@ -29,14 +28,14 @@ import java.time.OffsetDateTime; - import java.util.ArrayList; - import java.util.Collection; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class SetObject310InfinityTests extends BaseTest4 { - - public SetObject310InfinityTests(BinaryMode binaryMode) { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(2); - for (BaseTest4.BinaryMode binaryMode : BaseTest4.BinaryMode.values()) { -@@ -48,8 +47,8 @@ public class SetObject310InfinityTests extends BaseTest4 { - @Override - public void setUp() throws Exception { - super.setUp(); -- Assume.assumeTrue("PostgreSQL 8.3 does not support 'infinity' for 'date'", -- TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)); -+ Assumptions.assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4), -+ () -> "PostgreSQL 8.3 does not support 'infinity' for 'date'"); - super.setUp(); - TestUtil.createTable(con, "table1", "timestamp_without_time_zone_column timestamp without time zone," - + "timestamp_with_time_zone_column timestamp with time zone," -@@ -57,7 +56,7 @@ public class SetObject310InfinityTests extends BaseTest4 { - ); - } - -- @After -+ @Override - public void tearDown() throws SQLException { - TestUtil.dropTable(con, "table1"); - super.tearDown(); -diff --git a/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java b/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java -index d9599fd..237eaba 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java -+++ b/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java -@@ -5,19 +5,19 @@ - - package org.postgresql.test.jdbc42; - --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertNotNull; --import static org.junit.Assert.assertTrue; --import static org.junit.Assume.assumeTrue; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertNotNull; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assumptions.assumeTrue; - - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.AfterClass; --import org.junit.BeforeClass; --import org.junit.Test; --import org.junit.runner.RunWith; --import org.junit.runners.Parameterized; -+import org.junit.jupiter.api.AfterAll; -+import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Test; -+import org.junit.jupiter.params.ParameterizedClass; -+import org.junit.jupiter.params.provider.MethodSource; - - import java.sql.Connection; - import java.sql.PreparedStatement; -@@ -47,7 +47,8 @@ import java.util.List; - import java.util.Locale; - import java.util.TimeZone; - --@RunWith(Parameterized.class) -+@ParameterizedClass(name = "binary = {0}") -+@MethodSource("data") - public class SetObject310Test extends BaseTest4 { - private static final TimeZone saveTZ = TimeZone.getDefault(); - -@@ -75,7 +76,6 @@ public class SetObject310Test extends BaseTest4 { - setBinaryMode(binaryMode); - } - -- @Parameterized.Parameters(name = "binary = {0}") - public static Iterable data() { - Collection ids = new ArrayList<>(); - for (BaseTest4.BinaryMode binaryMode : BaseTest4.BinaryMode.values()) { -@@ -84,7 +84,7 @@ public class SetObject310Test extends BaseTest4 { - return ids; - } - -- @BeforeClass -+ @BeforeAll - public static void createTables() throws Exception { - try (Connection con = TestUtil.openDB()) { - TestUtil.createTable(con, "table1", "timestamp_without_time_zone_column timestamp without time zone," -@@ -96,7 +96,7 @@ public class SetObject310Test extends BaseTest4 { - } - } - -- @AfterClass -+ @AfterAll - public static void dropTables() throws Exception { - try (Connection con = TestUtil.openDB()) { - TestUtil.dropTable(con, "table1"); -@@ -175,8 +175,7 @@ public class SetObject310Test extends BaseTest4 { - - assertTrue(rs.next()); - if (checkRoundtrip) { -- assertEquals("Roundtrip set/getObject with type should return same result", -- data, rs.getObject(1, data.getClass())); -+ assertEquals(data, rs.getObject(1, data.getClass()), "Roundtrip set/getObject with type should return same result"); - } - return expectedType.cast(rs.getObject(1)); - } finally { -@@ -208,8 +207,10 @@ public class SetObject310Test extends BaseTest4 { - - assertTrue(rs.next()); - if (checkRoundtrip) { -- assertEquals("Roundtrip set/getObject with type should return same result", -- data, rs.getObject(1, data.getClass())); -+ assertEquals( -+ data, -+ rs.getObject(1, data.getClass()), -+ "Roundtrip set/getObject with type should return same result"); - } - return expectedType.cast(rs.getObject(1)); - } finally { -@@ -311,14 +312,16 @@ public class SetObject310Test extends BaseTest4 { - TimeZone.setDefault(TimeZone.getTimeZone(zoneId)); - String readBack = insertThenReadStringWithoutType(localDateTime, "timestamp_without_time_zone_column"); - assertEquals( -- "LocalDateTime=" + localDateTime + ", with TimeZone.default=" + zoneId + ", setObject(int, Object)", -- expected, readBack); -+ expected, -+ readBack, -+ () -> "LocalDateTime=" + localDateTime + ", with TimeZone.default=" + zoneId + ", setObject(int, Object)"); - deleteRows(); - - readBack = insertThenReadStringWithType(localDateTime, "timestamp_without_time_zone_column"); - assertEquals( -- "LocalDateTime=" + localDateTime + ", with TimeZone.default=" + zoneId + ", setObject(int, Object, TIMESTAMP)", -- expected, readBack); -+ expected, -+ readBack, -+ () -> "LocalDateTime=" + localDateTime + ", with TimeZone.default=" + zoneId + ", setObject(int, Object, TIMESTAMP)"); - deleteRows(); - } - -@@ -335,15 +338,17 @@ public class SetObject310Test extends BaseTest4 { - String noType = rs.getString(1); - OffsetDateTime noTypeRes = parseBackendTimestamp(noType); - assertEquals( -- "OffsetDateTime=" + data + " (with ZoneId=" + dataZone + "), with TimeZone.default=" -- + storeZone + ", setObject(int, Object)", data.toInstant(), -- noTypeRes.toInstant()); -+ data.toInstant(), -+ noTypeRes.toInstant(), -+ () -> "OffsetDateTime=" + data + " (with ZoneId=" + dataZone + "), with TimeZone" -+ + ".default=" + storeZone + ", setObject(int, Object)"); - String withType = rs.getString(2); - OffsetDateTime withTypeRes = parseBackendTimestamp(withType); - assertEquals( -- "OffsetDateTime=" + data + " (with ZoneId=" + dataZone + "), with TimeZone.default=" -- + storeZone + ", setObject(int, Object, TIMESTAMP_WITH_TIMEZONE)", -- data.toInstant(), withTypeRes.toInstant()); -+ data.toInstant(), -+ withTypeRes.toInstant(), -+ () -> "OffsetDateTime=" + data + " (with ZoneId=" + dataZone + "), with TimeZone" -+ + ".default=" + storeZone + ", setObject(int, Object, TIMESTAMP_WITH_TIMEZONE)"); - } - } - } -diff --git a/src/test/java/org/postgresql/test/jdbc42/SimpleJdbc42Test.java b/src/test/java/org/postgresql/test/jdbc42/SimpleJdbc42Test.java -index d765b6f..61ae8c3 100644 ---- a/src/test/java/org/postgresql/test/jdbc42/SimpleJdbc42Test.java -+++ b/src/test/java/org/postgresql/test/jdbc42/SimpleJdbc42Test.java -@@ -5,11 +5,11 @@ - - package org.postgresql.test.jdbc42; - --import static org.junit.Assert.assertTrue; -+import static org.junit.jupiter.api.Assertions.assertTrue; - - import org.postgresql.test.jdbc2.BaseTest4; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - /** - * Most basic test to check that the right package is compiled. -diff --git a/src/test/java/org/postgresql/test/util/ByteStreamWriterTest.java b/src/test/java/org/postgresql/test/util/ByteStreamWriterTest.java -index 0bea019..277dff5 100644 ---- a/src/test/java/org/postgresql/test/util/ByteStreamWriterTest.java -+++ b/src/test/java/org/postgresql/test/util/ByteStreamWriterTest.java -@@ -5,17 +5,18 @@ - - package org.postgresql.test.util; - --import static org.junit.Assert.assertArrayEquals; --import static org.junit.Assert.assertEquals; --import static org.junit.Assert.assertTrue; --import static org.junit.Assert.fail; -+import static org.junit.jupiter.api.Assertions.assertArrayEquals; -+import static org.junit.jupiter.api.Assertions.assertEquals; -+import static org.junit.jupiter.api.Assertions.assertInstanceOf; -+import static org.junit.jupiter.api.Assertions.assertTrue; -+import static org.junit.jupiter.api.Assertions.fail; - - import org.postgresql.test.TestUtil; - import org.postgresql.test.jdbc2.BaseTest4; - import org.postgresql.util.ByteBufferByteStreamWriter; - import org.postgresql.util.ByteStreamWriter; - --import org.junit.Test; -+import org.junit.jupiter.api.Test; - - import java.io.IOException; - import java.nio.ByteBuffer; -@@ -74,7 +75,7 @@ public class ByteStreamWriterTest extends BaseTest4 { - try { - rs.next(); - byte[] actualData = rs.getBytes(1); -- assertArrayEquals("Sent and received data are not the same", data, actualData); -+ assertArrayEquals(data, actualData, "Sent and received data are not the same"); - } finally { - rs.close(); - } -@@ -183,9 +184,8 @@ public class ByteStreamWriterTest extends BaseTest4 { - fail("did not throw exception when too much content"); - } catch (SQLException e) { - Throwable cause = e.getCause(); -- assertTrue("cause wan't an IOException", cause instanceof IOException); -- assertEquals("Incorrect exception message", -- cause.getMessage(), "Attempt to write more than the specified 4 bytes"); -+ assertInstanceOf(IOException.class, cause, "cause wan't an IOException"); -+ assertEquals(cause.getMessage(), "Attempt to write more than the specified 4 bytes", "Incorrect exception message"); - } - } - -@@ -197,7 +197,7 @@ public class ByteStreamWriterTest extends BaseTest4 { - fail("did not throw exception when IOException thrown"); - } catch (SQLException sqle) { - Throwable cause = sqle.getCause(); -- assertEquals("Incorrect exception cause", e, cause); -+ assertEquals(e, cause, "Incorrect exception cause"); - } - } - -@@ -209,11 +209,10 @@ public class ByteStreamWriterTest extends BaseTest4 { - fail("did not throw exception when RuntimeException thrown"); - } catch (SQLException sqle) { - Throwable cause = sqle.getCause(); -- assertTrue("cause wan't an IOException", cause instanceof IOException); -- assertEquals("Incorrect exception message", -- cause.getMessage(), "Error writing bytes to stream"); -+ assertInstanceOf(IOException.class, cause, "cause wan't an IOException"); -+ assertEquals(cause.getMessage(), "Error writing bytes to stream", "Incorrect exception message"); - Throwable nestedCause = cause.getCause(); -- assertEquals("Incorrect exception cause", e, nestedCause); -+ assertEquals(e, nestedCause, "Incorrect exception cause"); - } - } - -diff --git a/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension -deleted file mode 100644 -index 70d727d..0000000 ---- a/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension -+++ /dev/null -@@ -1 +0,0 @@ --org.postgresql.test.impl.AfterBeforeParameterResolver --- -2.49.0 - diff --git a/postgresql-jdbc.spec b/postgresql-jdbc.spec index ccd4eba..0b0d226 100644 --- a/postgresql-jdbc.spec +++ b/postgresql-jdbc.spec @@ -48,7 +48,7 @@ Summary: JDBC driver for PostgreSQL Name: postgresql-jdbc -Version: 42.7.7 +Version: 42.7.8 Release: %autorelease License: BSD-2-Clause URL: https://jdbc.postgresql.org/ @@ -57,26 +57,29 @@ Source1: postgresql_jdbc_tests_init.sh BuildArch: noarch ExclusiveArch: %{java_arches} noarch -Patch: 0001-Port-to-junit-5.13.patch - Provides: pgjdbc = %{version}-%{release} BuildRequires: maven-local-openjdk25 BuildRequires: mvn(com.ongres.scram:scram-client) BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin) BuildRequires: mvn(org.junit.jupiter:junit-jupiter-api) -BuildRequires: mvn(se.jiderhamn:classloader-leak-test-framework) %if %runselftest -BuildRequires: postgresql17-contrib -BuildRequires: postgresql17-test-rpm-macros +BuildRequires: postgresql-contrib +BuildRequires: postgresql-test-rpm-macros %endif +# gettext is only needed if we try to update translations +# BuildRequires: gettext + # TODO Remove in Fedora 46 Obsoletes: %{name}-javadoc < 42.7.4-9 -# gettext is only needed if we try to update translations -# BuildRequires: gettext +Provides: bundled(mvn(com.ongres.scram:scram-client)) = 3.2 +Provides: bundled(mvn(com.ongres.scram:scram-common)) = 3.2 +Provides: bundled(mvn(com.ongres.stringprep:saslprep)) = 2.2 +Provides: bundled(mvn(com.ongres.stringprep:stringprep)) = 2.2 %description PostgreSQL is an advanced Object-Relational database management system. The @@ -95,12 +98,6 @@ This package contains tests for %{name}. # remove any binary libs find -type f \( -name "*.jar" -or -name "*.class" \) -delete -%pom_remove_dep junit:junit -%pom_remove_dep org.junit.vintage:junit-vintage-engine - -# Build parent POMs in the same Maven call. -%pom_remove_plugin :maven-shade-plugin - # compat symlink: requested by dtardon (libreoffice), reverts part of # 0af97ce32de877 commit. %mvn_file org.postgresql:postgresql %{name}/postgresql %{name} postgresql @@ -145,7 +142,7 @@ opts="-DskipTests=true" %mvn_build -j -- $opts -xmvn -Dmdep.outputFile=tests-classpath dependency:build-classpath --offline +xmvn --offline -Dmdep.outputFile=tests-classpath dependency:build-classpath %install %mvn_install diff --git a/sources b/sources index a9e232c..5ede387 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (postgresql-42.7.7-jdbc-src.tar.gz) = f94f858e1732a6b38bd748014ccc335570ff9db8da84b8277e114f974abea1046d264fe75cde965eb270c70fccd323695b147a8e69fb7603fdfb4a0be0c7cd39 +SHA512 (postgresql-42.7.8-jdbc-src.tar.gz) = 4860f6446960ad4d38af28a3cd38cbc6bdd53d8acdd0c20cc3141df3e7a4b41aad67293f19aac6ae6d9da351b7e6379a0a02261d8bb188e1daae914f7ba0139f