This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 3d9ca68e88b Upgrade junit 5 on db-protocol module (#24447)
3d9ca68e88b is described below
commit 3d9ca68e88b22b76b1e1cfc90a13e7e0165707c5
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Mar 4 00:42:10 2023 +0800
Upgrade junit 5 on db-protocol module (#24447)
---
.../codec/OpenGaussPacketCodecEngineTest.java | 17 +++--
.../OpenGaussAuthenticationHexDataTest.java | 2 +-
...enGaussAuthenticationSCRAMSha256PacketTest.java | 2 +-
.../command/OpenGaussCommandPacketFactoryTest.java | 8 +-
.../command/OpenGaussCommandPacketTypeTest.java | 2 +-
.../generic/OpenGaussErrorResponsePacketTest.java | 2 +-
.../bind/OpenGaussComBatchBindPacketTest.java | 4 +-
.../codec/PostgreSQLPacketCodecEngineTest.java | 17 +++--
.../constant/PostgreSQLArrayColumnTypeTest.java | 7 +-
.../constant/PostgreSQLColumnTypeTest.java | 11 +--
.../constant/PostgreSQLServerInfoTest.java | 2 +-
.../PostgreSQLCommandPacketFactoryTest.java | 8 +-
.../PostgreSQLCommandPacketTypeLoaderTest.java | 7 +-
.../command/PostgreSQLCommandPacketTypeTest.java | 9 ++-
.../PostgreSQLUnsupportedCommandPacketTest.java | 8 +-
.../query/PostgreSQLColumnDescriptionTest.java | 2 +-
.../command/query/PostgreSQLDataRowPacketTest.java | 20 +++--
.../PostgreSQLEmptyQueryResponsePacketTest.java | 2 +-
.../command/query/PostgreSQLNoDataPacketTest.java | 2 +-
.../query/PostgreSQLRowDescriptionPacketTest.java | 8 +-
.../PostgreSQLAggregatedResponsesPacketTest.java | 2 +-
.../bind/PostgreSQLBindCompletePacketTest.java | 2 +-
.../extended/bind/PostgreSQLComBindPacketTest.java | 4 +-
.../PostgreSQLTypeUnspecifiedSQLParameterTest.java | 2 +-
.../PostgreSQLArrayParameterDecoderTest.java | 8 +-
.../PostgreSQLBinaryProtocolValueFactoryTest.java | 7 +-
.../PostgreSQLBinaryTimestampUtilsTest.java | 2 +-
...PostgreSQLBoolArrayBinaryProtocolValueTest.java | 12 +--
.../bind/protocol/PostgreSQLByteConverterTest.java | 45 ++++++-----
.../PostgreSQLByteaBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLDateBinaryProtocolValueTest.java | 8 +-
.../PostgreSQLDoubleBinaryProtocolValueTest.java | 8 +-
...stgreSQLFloat4ArrayBinaryProtocolValueTest.java | 12 +--
...stgreSQLFloat8ArrayBinaryProtocolValueTest.java | 11 +--
.../PostgreSQLFloatBinaryProtocolValueTest.java | 8 +-
...PostgreSQLInt2ArrayBinaryProtocolValueTest.java | 12 +--
.../PostgreSQLInt2BinaryProtocolValueTest.java | 2 +-
...PostgreSQLInt4ArrayBinaryProtocolValueTest.java | 12 +--
.../PostgreSQLInt4BinaryProtocolValueTest.java | 8 +-
...PostgreSQLInt8ArrayBinaryProtocolValueTest.java | 12 +--
.../PostgreSQLInt8BinaryProtocolValueTest.java | 8 +-
.../PostgreSQLNumericBinaryProtocolValueTest.java | 57 +++++++-------
...stgreSQLStringArrayBinaryProtocolValueTest.java | 12 +--
.../PostgreSQLStringBinaryProtocolValueTest.java | 12 +--
.../bind/protocol/PostgreSQLTextTimeUtilsTest.java | 79 ++++++++++----------
.../protocol/PostgreSQLTextTimestampUtilsTest.java | 87 +++++++++++-----------
.../PostgreSQLTimeBinaryProtocolValueTest.java | 8 +-
...stgreSQLUnspecifiedBinaryProtocolValueTest.java | 12 +--
.../close/PostgreSQLCloseCompletePacketTest.java | 2 +-
.../close/PostgreSQLComClosePacketTest.java | 13 ++--
.../describe/PostgreSQLComDescribePacketTest.java | 8 +-
.../execute/PostgreSQLComExecutePacketTest.java | 8 +-
.../parse/PostgreSQLComParsePacketTest.java | 8 +-
.../parse/PostgreSQLParseCompletePacketTest.java | 2 +-
.../extended/sync/PostgreSQLComSyncPacketTest.java | 8 +-
.../query/simple/PostgreSQLComQueryPacketTest.java | 8 +-
.../PostgreSQLAuthenticationOKPacketTest.java | 2 +-
.../generic/PostgreSQLComStartupPacketTest.java | 2 +-
.../PostgreSQLComTerminationPacketTest.java | 2 +-
.../PostgreSQLCommandCompletePacketTest.java | 2 +-
.../generic/PostgreSQLErrorResponsePacketTest.java | 10 +--
...tgreSQLMD5PasswordAuthenticationPacketTest.java | 2 +-
.../PostgreSQLParameterStatusPacketTest.java | 2 +-
.../PostgreSQLPasswordMessagePacketTest.java | 2 +-
.../generic/PostgreSQLReadyForQueryPacketTest.java | 2 +-
.../generic/PostgreSQLSSLNegativePacketTest.java | 2 +-
.../handshake/PostgreSQLRandomGeneratorTest.java | 2 +-
.../PostgreSQLMessagePacketTypeTest.java | 7 +-
.../payload/PostgreSQLPacketPayloadTest.java | 2 +-
69 files changed, 349 insertions(+), 341 deletions(-)
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngineTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngineTest.java
index 53d39c460fc..6c558edcd9f 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngineTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/codec/OpenGaussPacketCodecEngineTest.java
@@ -24,12 +24,14 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
@@ -38,14 +40,15 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
public final class OpenGaussPacketCodecEngineTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -54,7 +57,7 @@ public final class OpenGaussPacketCodecEngineTest {
@Mock
private ByteBuf byteBuf;
- @Before
+ @BeforeEach
public void setup() {
when(context.channel().attr(AttributeKey.<Charset>valueOf(Charset.class.getName())).get()).thenReturn(StandardCharsets.UTF_8);
}
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationHexDataTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationHexDataTest.java
index e70dea3d749..bdf8a3c79b7 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationHexDataTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationHexDataTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.db.protocol.opengauss.packet.authentication;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationSCRAMSha256PacketTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationSCRAMSha256PacketTest.java
index 534c7a3b98f..f34546036b0 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationSCRAMSha256PacketTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/authentication/OpenGaussAuthenticationSCRAMSha256PacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.opengauss.packet.authentication;
import
org.apache.shardingsphere.db.protocol.opengauss.constant.OpenGaussProtocolVersion;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java
index 53adc5507fe..55b956457a1 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java
@@ -22,18 +22,18 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQ
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLAggregatedCommandPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class OpenGaussCommandPacketFactoryTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
index fb1e7f2ffac..0f33b0fc942 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.opengauss.packet.command;
import org.apache.shardingsphere.db.protocol.packet.CommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
index 430782cdaad..20c74e8830e 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.opengauss.packet.command.generic;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opengauss.util.ServerErrorMessage;
import static org.hamcrest.CoreMatchers.is;
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
index 7fafd364e58..8cae349ac88 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.db.protocol.opengauss.packet.command.query.ext
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
@@ -28,7 +28,7 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class OpenGaussComBatchBindPacketTest {
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngineTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngineTest.java
index b2e470a1624..7d1b0c39877 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngineTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngineTest.java
@@ -24,12 +24,14 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
@@ -38,14 +40,15 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
public final class PostgreSQLPacketCodecEngineTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -54,7 +57,7 @@ public final class PostgreSQLPacketCodecEngineTest {
@Mock
private ByteBuf byteBuf;
- @Before
+ @BeforeEach
public void setup() {
when(context.channel().attr(AttributeKey.<Charset>valueOf(Charset.class.getName())).get()).thenReturn(StandardCharsets.UTF_8);
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
index 3b7610b150f..e8054fd739f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLArrayColumnTypeTest.java
@@ -17,10 +17,11 @@
package org.apache.shardingsphere.db.protocol.postgresql.constant;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLArrayColumnTypeTest {
@@ -29,8 +30,8 @@ public final class PostgreSQLArrayColumnTypeTest {
assertThat(PostgreSQLArrayColumnType.getTypeOid("_int4"), is(1007));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertGetTypeOidFailed() {
- PostgreSQLArrayColumnType.getTypeOid("not_exist_type");
+ assertThrows(IllegalArgumentException.class, () ->
PostgreSQLArrayColumnType.getTypeOid("not_exist_type"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
index da3594d6fa4..8c1afbffe9a 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
@@ -19,12 +19,13 @@ package
org.apache.shardingsphere.db.protocol.postgresql.constant;
import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProtocolException;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.sql.Types;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLColumnTypeTest {
@@ -40,9 +41,9 @@ public final class PostgreSQLColumnTypeTest {
assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BOOL));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertValueOfJDBCTypeExThrown() {
- PostgreSQLColumnType.valueOfJDBCType(Types.REF_CURSOR);
+ assertThrows(IllegalArgumentException.class, () ->
PostgreSQLColumnType.valueOfJDBCType(Types.REF_CURSOR));
}
@Test
@@ -51,9 +52,9 @@ public final class PostgreSQLColumnTypeTest {
assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8));
}
- @Test(expected = PostgreSQLProtocolException.class)
+ @Test
public void assertValueOfExThrown() {
- PostgreSQLColumnType.valueOf(9999);
+ assertThrows(PostgreSQLProtocolException.class, () ->
PostgreSQLColumnType.valueOf(9999));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLServerInfoTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLServerInfoTest.java
index adc50cc4af7..e3da9aaa1cc 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLServerInfoTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLServerInfoTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.db.protocol.postgresql.constant;
import org.apache.shardingsphere.db.protocol.constant.CommonConstants;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java
index 620e13f5e4f..981f9f65403 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java
@@ -22,17 +22,17 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ext
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.simple.PostgreSQLComQueryPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLComTerminationPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLCommandPacketFactoryTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
index 894a85256b8..6c5d93b03ba 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeLoaderTest.java
@@ -19,10 +19,11 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command;
import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProtocolException;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
@@ -37,10 +38,10 @@ public final class PostgreSQLCommandPacketTypeLoaderTest {
assertThat(PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload),
is(PostgreSQLCommandPacketType.SIMPLE_QUERY));
}
- @Test(expected = PostgreSQLProtocolException.class)
+ @Test
public void assertGetCommandPacketTypeError() {
PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class,
RETURNS_DEEP_STUBS);
when(payload.getByteBuf().getByte(anyInt())).thenReturn((byte) 'a');
- PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload);
+ assertThrows(PostgreSQLProtocolException.class, () ->
PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
index aaa8a528d50..b2b4e15feb9 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
@@ -18,15 +18,16 @@
package org.apache.shardingsphere.db.protocol.postgresql.packet.command;
import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProtocolException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class PostgreSQLCommandPacketTypeTest {
- @Test(expected = PostgreSQLProtocolException.class)
+ @Test
public void assertValueOfUnknownCommandPacketType() {
- PostgreSQLCommandPacketType.valueOf(-1);
+ assertThrows(PostgreSQLProtocolException.class, () ->
PostgreSQLCommandPacketType.valueOf(-1));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacketTest.java
index 28c3d208404..aba71edcf4f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacketTest.java
@@ -20,17 +20,17 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.admin;
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLUnsupportedCommandPacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescriptionTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescriptionTest.java
index d462e6c320f..48c9bd31d1e 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescriptionTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLColumnDescriptionTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.sql.Types;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
index 4f5867f525d..405b1d57d3f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
@@ -21,11 +21,13 @@ import
org.apache.shardingsphere.db.protocol.binary.BinaryCell;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
@@ -34,12 +36,14 @@ import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
public final class PostgreSQLDataRowPacketTest {
@Mock
@@ -48,7 +52,7 @@ public final class PostgreSQLDataRowPacketTest {
@Mock
private SQLXML sqlxml;
- @Before
+ @BeforeEach
public void setup() {
when(payload.getCharset()).thenReturn(StandardCharsets.UTF_8);
}
@@ -88,11 +92,11 @@ public final class PostgreSQLDataRowPacketTest {
verify(payload).writeBytes(valueBytes);
}
- @Test(expected = RuntimeException.class)
+ @Test
public void assertWriteWithSQLXML4Error() throws SQLException {
when(sqlxml.getString()).thenThrow(new SQLException("mock"));
PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(sqlxml));
- actual.write(payload);
+ assertThrows(RuntimeException.class, () -> actual.write(payload));
verify(payload, times(0)).writeStringEOF(any());
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLEmptyQueryResponsePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLEmptyQueryResponsePacketTest.java
index 4c286687036..795f7a58ceb 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLEmptyQueryResponsePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLEmptyQueryResponsePacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLNoDataPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLNoDataPacketTest.java
index c662c7ebd6a..1b215ee3955 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLNoDataPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLNoDataPacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query;
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLRowDescriptionPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLRowDescriptionPacketTest.java
index 7cb7a86d01e..7049d309d3e 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLRowDescriptionPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLRowDescriptionPacketTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.sql.Types;
import java.util.Collections;
@@ -32,7 +32,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLRowDescriptionPacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLAggregatedResponsesPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLAggregatedResponsesPacketTest.java
index 880bbfb71db..ed12d2debbe 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLAggregatedResponsesPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLAggregatedResponsesPacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLBindCompletePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLBindCompletePacketTest.java
index 4f96dbddbb3..28f14ef696d 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLBindCompletePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLBindCompletePacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
index 0a4a8dcdf15..1c6f396dc94 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
@@ -20,14 +20,14 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class PostgreSQLComBindPacketTest {
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLTypeUnspecifiedSQLParameterTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLTypeUnspecifiedSQLParameterTest.java
index 51f24687722..7445b737c62 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLTypeUnspecifiedSQLParameterTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLTypeUnspecifiedSQLParameterTest.java
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java
index dc6bec15574..812981b52e7 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java
@@ -17,13 +17,13 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class PostgreSQLArrayParameterDecoderTest {
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
index ccca6a9ace8..40f1be6bd7a 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
@@ -18,10 +18,11 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLBinaryProtocolValueFactoryTest {
@@ -85,8 +86,8 @@ public final class PostgreSQLBinaryProtocolValueFactoryTest {
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLTimeBinaryProtocolValue.class));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertGetBinaryProtocolValueExThrown() {
-
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_XML);
+ assertThrows(IllegalArgumentException.class, () ->
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_XML));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtilsTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtilsTest.java
index 40ccb2e2a74..6377675015e 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtilsTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtilsTest.java
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.sql.Timestamp;
import java.util.TimeZone;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
index b4886f4ee77..e69e287666f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLBoolArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class PostgreSQLBoolArrayBinaryProtocolValueTest
{
return new PostgreSQLBoolArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class PostgreSQLBoolArrayBinaryProtocolValueTest
{
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteConverterTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteConverterTest.java
index 3c437139088..91ab1d22fbc 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteConverterTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteConverterTest.java
@@ -17,39 +17,36 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
-import lombok.RequiredArgsConstructor;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
import java.math.BigDecimal;
-import java.util.Arrays;
+import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(Parameterized.class)
-@RequiredArgsConstructor
public final class PostgreSQLByteConverterTest {
- private final BigDecimal input;
-
- private final byte[] expected;
-
- @Parameters(name = "{0}")
- public static Iterable<Object[]> textValues() {
- return Arrays.asList(
- new Object[]{new BigDecimal("0"), new byte[]{0, 0, -1, -1, 0,
0, 0, 0}},
- new Object[]{new BigDecimal("0.00"), new byte[]{0, 0, -1, -1,
0, 0, 0, 2}},
- new Object[]{new BigDecimal("0.0001"), new byte[]{0, 1, -1,
-1, 0, 0, 0, 4, 0, 1}},
- new Object[]{new BigDecimal("9999"), new byte[]{0, 1, 0, 0, 0,
0, 0, 0, 39, 15}},
- new Object[]{new BigDecimal("9999.0"), new byte[]{0, 1, 0, 0,
0, 0, 0, 1, 39, 15}},
- new Object[]{new BigDecimal("9999.9999"), new byte[]{0, 2, 0,
0, 0, 0, 0, 4, 39, 15, 39, 15}});
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertNumeric(final BigDecimal input, final byte[] expected) {
+ assertThat(PostgreSQLByteConverter.numeric(input), is(expected));
}
- @Test
- public void assertNumeric() {
- assertThat(PostgreSQLByteConverter.numeric(input), is(expected));
+ private static class TestCaseArgumentsProvider implements
ArgumentsProvider {
+
+ @Override
+ public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
+ return Stream.of(Arguments.of(new BigDecimal("0"), new byte[]{0,
0, -1, -1, 0, 0, 0, 0}),
+ Arguments.of(new BigDecimal("0.00"), new byte[]{0, 0, -1,
-1, 0, 0, 0, 2}),
+ Arguments.of(new BigDecimal("0.0001"), new byte[]{0, 1,
-1, -1, 0, 0, 0, 4, 0, 1}),
+ Arguments.of(new BigDecimal("9999"), new byte[]{0, 1, 0,
0, 0, 0, 0, 0, 39, 15}),
+ Arguments.of(new BigDecimal("9999.0"), new byte[]{0, 1, 0,
0, 0, 0, 0, 1, 39, 15}),
+ Arguments.of(new BigDecimal("9999.9999"), new byte[]{0, 2,
0, 0, 0, 0, 0, 4, 39, 15, 39, 15}));
+ }
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
index b5cf954f6fa..0c11cb98792 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
index fd8186beed0..e07b687165d 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
@@ -19,9 +19,9 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.postgresql.jdbc.TimestampUtils;
import org.postgresql.util.PSQLException;
@@ -31,7 +31,7 @@ import java.sql.Date;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLDateBinaryProtocolValueTest {
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
index 9050037e6e9..e9b0a34c30f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.StandardCharsets;
@@ -31,7 +31,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLDoubleBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
index 2e5027b2534..5ceb520261f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLFloat4ArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class
PostgreSQLFloat4ArrayBinaryProtocolValueTest {
return new PostgreSQLFloat4ArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class
PostgreSQLFloat4ArrayBinaryProtocolValueTest {
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
index 2eb0301e6af..5ac07599aea 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLFloat8ArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class
PostgreSQLFloat8ArrayBinaryProtocolValueTest {
return new PostgreSQLFloat8ArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,8 +54,8 @@ public final class
PostgreSQLFloat8ArrayBinaryProtocolValueTest {
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
index 0c02221a0d1..81eb31e557b 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.StandardCharsets;
@@ -31,7 +31,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLFloatBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
index ab0e85760a9..3eea3a674cc 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLInt2ArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class PostgreSQLInt2ArrayBinaryProtocolValueTest
{
return new PostgreSQLInt2ArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class PostgreSQLInt2ArrayBinaryProtocolValueTest
{
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
index acc1bfea012..b780d392119 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
index 727a45fb11d..bf95cc028ce 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLInt4ArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class PostgreSQLInt4ArrayBinaryProtocolValueTest
{
return new PostgreSQLInt4ArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class PostgreSQLInt4ArrayBinaryProtocolValueTest
{
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
index fcc4500b7d4..b0ddd4376d2 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
@@ -18,17 +18,17 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLInt4BinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
index a520df956b0..1e08229cf75 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
public final class PostgreSQLInt8ArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class PostgreSQLInt8ArrayBinaryProtocolValueTest
{
return new PostgreSQLInt8ArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class PostgreSQLInt8ArrayBinaryProtocolValueTest
{
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
index e78ee134af4..a50416d4752 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
@@ -19,9 +19,9 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLInt8BinaryProtocolValueTest {
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
index 15007d37d4c..6a00ee7b277 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
@@ -18,48 +18,33 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
import io.netty.buffer.ByteBuf;
-import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
+import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(Parameterized.class)
-@RequiredArgsConstructor
public final class PostgreSQLNumericBinaryProtocolValueTest {
- private final BigDecimal bigDecimal;
-
- private final byte[] expected;
-
- @Parameters(name = "{0}")
- public static Iterable<Object[]> textValues() {
- return Arrays.asList(
- new Object[]{new BigDecimal("0"), new byte[]{0, 0, -1, -1, 0,
0, 0, 0}},
- new Object[]{new BigDecimal("0.00"), new byte[]{0, 0, -1, -1,
0, 0, 0, 2}},
- new Object[]{new BigDecimal("0.0001"), new byte[]{0, 1, -1,
-1, 0, 0, 0, 4, 0, 1}},
- new Object[]{new BigDecimal("9999"), new byte[]{0, 1, 0, 0, 0,
0, 0, 0, 39, 15}},
- new Object[]{new BigDecimal("9999.0"), new byte[]{0, 1, 0, 0,
0, 0, 0, 1, 39, 15}},
- new Object[]{new BigDecimal("9999.9999"), new byte[]{0, 2, 0,
0, 0, 0, 0, 4, 39, 15, 39, 15}});
- }
-
- @Test
- public void assertGetColumnLength() {
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertGetColumnLength(final BigDecimal bigDecimal, final
byte[] expected) {
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
assertThat(binaryProtocolValue.getColumnLength(bigDecimal),
is(expected.length));
}
- @Test
- public void assertRead() {
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertRead(final BigDecimal bigDecimal, final byte[] expected)
{
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
int expectedLength = expected.length;
ByteBuf byteBuf = ByteBufTestUtils.createByteBuf(expectedLength);
@@ -70,8 +55,9 @@ public final class PostgreSQLNumericBinaryProtocolValueTest {
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test
- public void assertWrite() {
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertWrite(final BigDecimal bigDecimal, final byte[]
expected) {
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
int columnLength = binaryProtocolValue.getColumnLength(bigDecimal);
ByteBuf byteBuf = ByteBufTestUtils.createByteBuf(columnLength);
@@ -81,4 +67,17 @@ public final class PostgreSQLNumericBinaryProtocolValueTest {
byteBuf.readBytes(actualBytes);
assertThat(actualBytes, is(expected));
}
+
+ private static class TestCaseArgumentsProvider implements
ArgumentsProvider {
+
+ @Override
+ public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
+ return Stream.of(Arguments.of(new BigDecimal("0"), new byte[]{0,
0, -1, -1, 0, 0, 0, 0}),
+ Arguments.of(new BigDecimal("0.00"), new byte[]{0, 0, -1,
-1, 0, 0, 0, 2}),
+ Arguments.of(new BigDecimal("0.0001"), new byte[]{0, 1,
-1, -1, 0, 0, 0, 4, 0, 1}),
+ Arguments.of(new BigDecimal("9999"), new byte[]{0, 1, 0,
0, 0, 0, 0, 0, 39, 15}),
+ Arguments.of(new BigDecimal("9999.0"), new byte[]{0, 1, 0,
0, 0, 0, 0, 1, 39, 15}),
+ Arguments.of(new BigDecimal("9999.9999"), new byte[]{0, 2,
0, 0, 0, 0, 0, 4, 39, 15, 39, 15}));
+ }
+ }
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
index 7a3ef17474b..a824ad2a16c 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
@@ -21,12 +21,13 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLStringArrayBinaryProtocolValueTest {
@@ -34,9 +35,9 @@ public final class
PostgreSQLStringArrayBinaryProtocolValueTest {
return new PostgreSQLStringArrayBinaryProtocolValue();
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- newInstance().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class
PostgreSQLStringArrayBinaryProtocolValueTest {
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- newInstance().write(new PostgreSQLPacketPayload(null,
StandardCharsets.UTF_8), "val");
+ assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
index a4f792ddefb..e9f6a017bd3 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
@@ -19,11 +19,11 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.stubbing.Answer;
import java.nio.charset.StandardCharsets;
@@ -34,7 +34,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLStringBinaryProtocolValueTest {
@Mock
@@ -42,7 +42,7 @@ public final class PostgreSQLStringBinaryProtocolValueTest {
private PostgreSQLPacketPayload payload;
- @Before
+ @BeforeEach
public void setup() {
payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8);
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtilsTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtilsTest.java
index b47a3ec8413..db425b1307b 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtilsTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtilsTest.java
@@ -17,56 +17,53 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
-import lombok.RequiredArgsConstructor;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
import java.time.LocalTime;
-import java.util.Arrays;
+import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(Parameterized.class)
-@RequiredArgsConstructor
public final class PostgreSQLTextTimeUtilsTest {
- private final String input;
-
- private final LocalTime expected;
-
- @Parameters(name = "{0}")
- public static Iterable<Object[]> textValues() {
- return Arrays.asList(
- new Object[]{"2323", LocalTime.of(23, 23, 0)},
- new Object[]{"23:23", LocalTime.of(23, 23, 0)},
- new Object[]{"232323", LocalTime.of(23, 23, 23)},
- new Object[]{"23:23:23", LocalTime.of(23, 23, 23)},
- new Object[]{"23:23:23.1", LocalTime.of(23, 23, 23,
100_000_000)},
- new Object[]{"23:23:23.12", LocalTime.of(23, 23, 23,
120_000_000)},
- new Object[]{"23:23:23.123", LocalTime.of(23, 23, 23,
123_000_000)},
- new Object[]{"23:23:23.123+08", LocalTime.of(23, 23, 23,
123_000_000)},
- new Object[]{"23:23:23.123+08", LocalTime.of(23, 23, 23,
123_000_000)},
- new Object[]{"23:23:23.12345", LocalTime.of(23, 23, 23,
123_450_000)},
- new Object[]{"23:23:23.12345+0800", LocalTime.of(23, 23, 23,
123_450_000)},
- new Object[]{"23:23:23.12345+0800", LocalTime.of(23, 23, 23,
123_450_000)},
- new Object[]{"23:23:23.12345+08:00:00", LocalTime.of(23, 23,
23, 123_450_000)},
- new Object[]{"23:23:23.12345+08:00:00", LocalTime.of(23, 23,
23, 123_450_000)},
- new Object[]{"23:23:23.12345+08:00:00", LocalTime.of(23, 23,
23, 123_450_000)},
- new Object[]{"23:23:23.123456", LocalTime.of(23, 23, 23,
123_456_000)},
- new Object[]{"23:23:23.1234567", LocalTime.of(23, 23, 23,
123_456_700)},
- new Object[]{"23:23:23.12345678", LocalTime.of(23, 23, 23,
123_456_780)},
- new Object[]{"23:23:23.123456789", LocalTime.of(23, 23, 23,
123_456_789)},
- new Object[]{"23:23:23.123456 +08:00", LocalTime.of(23, 23,
23, 123_456_000)},
- new Object[]{"23:23:23.123456 -08:00", LocalTime.of(23, 23,
23, 123_456_000)},
- new Object[]{"23:23:23.123456789 +08:00", LocalTime.of(23, 23,
23, 123_456_789)},
- new Object[]{"23:23:23.123456", LocalTime.of(23, 23, 23,
123_456_000)});
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertParse(final String input, final LocalTime expected) {
+ assertThat(PostgreSQLTextTimeUtils.parse(input), is(expected));
}
- @Test
- public void assertParse() {
- assertThat(PostgreSQLTextTimeUtils.parse(input), is(expected));
+ private static class TestCaseArgumentsProvider implements
ArgumentsProvider {
+
+ @Override
+ public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
+ return Stream.of(Arguments.of("2323", LocalTime.of(23, 23, 0)),
+ Arguments.of("23:23", LocalTime.of(23, 23, 0)),
+ Arguments.of("232323", LocalTime.of(23, 23, 23)),
+ Arguments.of("23:23:23", LocalTime.of(23, 23, 23)),
+ Arguments.of("23:23:23.1", LocalTime.of(23, 23, 23,
100_000_000)),
+ Arguments.of("23:23:23.12", LocalTime.of(23, 23, 23,
120_000_000)),
+ Arguments.of("23:23:23.123", LocalTime.of(23, 23, 23,
123_000_000)),
+ Arguments.of("23:23:23.123+08", LocalTime.of(23, 23, 23,
123_000_000)),
+ Arguments.of("23:23:23.123+08", LocalTime.of(23, 23, 23,
123_000_000)),
+ Arguments.of("23:23:23.12345", LocalTime.of(23, 23, 23,
123_450_000)),
+ Arguments.of("23:23:23.12345+0800", LocalTime.of(23, 23,
23, 123_450_000)),
+ Arguments.of("23:23:23.12345+0800", LocalTime.of(23, 23,
23, 123_450_000)),
+ Arguments.of("23:23:23.12345+08:00:00", LocalTime.of(23,
23, 23, 123_450_000)),
+ Arguments.of("23:23:23.12345+08:00:00", LocalTime.of(23,
23, 23, 123_450_000)),
+ Arguments.of("23:23:23.12345+08:00:00", LocalTime.of(23,
23, 23, 123_450_000)),
+ Arguments.of("23:23:23.123456", LocalTime.of(23, 23, 23,
123_456_000)),
+ Arguments.of("23:23:23.1234567", LocalTime.of(23, 23, 23,
123_456_700)),
+ Arguments.of("23:23:23.12345678", LocalTime.of(23, 23, 23,
123_456_780)),
+ Arguments.of("23:23:23.123456789", LocalTime.of(23, 23,
23, 123_456_789)),
+ Arguments.of("23:23:23.123456 +08:00", LocalTime.of(23,
23, 23, 123_456_000)),
+ Arguments.of("23:23:23.123456 -08:00", LocalTime.of(23,
23, 23, 123_456_000)),
+ Arguments.of("23:23:23.123456789 +08:00", LocalTime.of(23,
23, 23, 123_456_789)),
+ Arguments.of("23:23:23.123456", LocalTime.of(23, 23, 23,
123_456_000)));
+ }
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtilsTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtilsTest.java
index e8ef42f58e4..c091b134ef5 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtilsTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtilsTest.java
@@ -17,60 +17,57 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
-import lombok.RequiredArgsConstructor;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
import java.sql.Timestamp;
-import java.util.Arrays;
+import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(Parameterized.class)
-@RequiredArgsConstructor
public final class PostgreSQLTextTimestampUtilsTest {
- private final String input;
-
- private final Timestamp expected;
-
- @Parameters(name = "{0}")
- public static Iterable<Object[]> textValues() {
- return Arrays.asList(
- new Object[]{"20211012 2323", Timestamp.valueOf("2021-10-12
23:23:00")},
- new Object[]{"20211012 23:23", Timestamp.valueOf("2021-10-12
23:23:00")},
- new Object[]{"20211012 232323", Timestamp.valueOf("2021-10-12
23:23:23")},
- new Object[]{"2021-10-12 23:23:23",
Timestamp.valueOf("2021-10-12 23:23:23")},
- new Object[]{"2021-10-12 23:23:23.1",
Timestamp.valueOf("2021-10-12 23:23:23.1")},
- new Object[]{"2021-10-12 23:23:23.12",
Timestamp.valueOf("2021-10-12 23:23:23.12")},
- new Object[]{"2021-10-12 23:23:23.123",
Timestamp.valueOf("2021-10-12 23:23:23.123")},
- new Object[]{"2021-10-12 23:23:23.123+08",
Timestamp.valueOf("2021-10-12 23:23:23.123")},
- new Object[]{"2021-10-12T23:23:23.123+08",
Timestamp.valueOf("2021-10-12 23:23:23.123")},
- new Object[]{"2021-10-12 23:23:23.12345",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"2021-10-12 23:23:23.12345+0800",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"20211012 23:23:23.12345+0800",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"2021-10-12 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"211012 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"10/12/21 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")},
- new Object[]{"2021-10-12 23:23:23.123456",
Timestamp.valueOf("2021-10-12 23:23:23.123456")},
- new Object[]{"2021-10-12 23:23:23.1234567",
Timestamp.valueOf("2021-10-12 23:23:23.1234567")},
- new Object[]{"2021-10-12 23:23:23.12345678",
Timestamp.valueOf("2021-10-12 23:23:23.12345678")},
- new Object[]{"2021-10-12 23:23:23.123456789",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")},
- new Object[]{"2021-10-12 23:23:23.123456 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456")},
- // TODO The following 4 cases are related to user.timezone of
test environment
- // new Object[]{"2021-10-12 23:23:23.1234567 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.1234567")},
- // new Object[]{"2021-10-12 23:23:23.12345678 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345678")},
- // new Object[]{"2021-10-12 23:23:23.123456789+08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")},
- // new Object[]{"2021-10-12 23:23:23.123456789 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")},
- new Object[]{"2021-10-12 23:23:23.123456 -08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456")},
- new Object[]{"2021-3-3 23:23:23.123456",
Timestamp.valueOf("2021-03-03 23:23:23.123456")});
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ public void assertGetLocalDateTimeNoExceptionOccurs(final String input,
final Timestamp expected) {
+ assertThat(PostgreSQLTextTimestampUtils.parse(input), is(expected));
}
- @Test
- public void assertGetLocalDateTimeNoExceptionOccurs() {
- assertThat(PostgreSQLTextTimestampUtils.parse(input), is(expected));
+ private static class TestCaseArgumentsProvider implements
ArgumentsProvider {
+
+ @Override
+ public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
+ return Stream.of(Arguments.of("20211012 2323",
Timestamp.valueOf("2021-10-12 23:23:00")),
+ Arguments.of("20211012 23:23",
Timestamp.valueOf("2021-10-12 23:23:00")),
+ Arguments.of("20211012 232323",
Timestamp.valueOf("2021-10-12 23:23:23")),
+ Arguments.of("2021-10-12 23:23:23",
Timestamp.valueOf("2021-10-12 23:23:23")),
+ Arguments.of("2021-10-12 23:23:23.1",
Timestamp.valueOf("2021-10-12 23:23:23.1")),
+ Arguments.of("2021-10-12 23:23:23.12",
Timestamp.valueOf("2021-10-12 23:23:23.12")),
+ Arguments.of("2021-10-12 23:23:23.123",
Timestamp.valueOf("2021-10-12 23:23:23.123")),
+ Arguments.of("2021-10-12 23:23:23.123+08",
Timestamp.valueOf("2021-10-12 23:23:23.123")),
+ Arguments.of("2021-10-12T23:23:23.123+08",
Timestamp.valueOf("2021-10-12 23:23:23.123")),
+ Arguments.of("2021-10-12 23:23:23.12345",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("2021-10-12 23:23:23.12345+0800",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("20211012 23:23:23.12345+0800",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("2021-10-12 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("211012 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("10/12/21 23:23:23.12345+08:00:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345")),
+ Arguments.of("2021-10-12 23:23:23.123456",
Timestamp.valueOf("2021-10-12 23:23:23.123456")),
+ Arguments.of("2021-10-12 23:23:23.1234567",
Timestamp.valueOf("2021-10-12 23:23:23.1234567")),
+ Arguments.of("2021-10-12 23:23:23.12345678",
Timestamp.valueOf("2021-10-12 23:23:23.12345678")),
+ Arguments.of("2021-10-12 23:23:23.123456789",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")),
+ Arguments.of("2021-10-12 23:23:23.123456 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456")),
+ // TODO The following 4 cases are related to user.timezone
of test environment
+ // Arguments.of("2021-10-12 23:23:23.1234567 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.1234567")),
+ // Arguments.of("2021-10-12 23:23:23.12345678 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.12345678")),
+ // Arguments.of("2021-10-12 23:23:23.123456789+08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")),
+ // Arguments.of("2021-10-12 23:23:23.123456789 +08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456789")),
+ Arguments.of("2021-10-12 23:23:23.123456 -08:00",
Timestamp.valueOf("2021-10-12 23:23:23.123456")),
+ Arguments.of("2021-3-3 23:23:23.123456",
Timestamp.valueOf("2021-03-03 23:23:23.123456")));
+ }
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
index 74b54f3a110..615c95d9281 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
@@ -18,10 +18,10 @@
package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.sql.Timestamp;
@@ -30,7 +30,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLTimeBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
index 15fb3058863..b816d0986c1 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
@@ -22,20 +22,21 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLTypeUnspecifiedSQLParameter;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
public final class PostgreSQLUnspecifiedBinaryProtocolValueTest {
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertGetColumnLength() {
- new PostgreSQLUnspecifiedBinaryProtocolValue().getColumnLength("val");
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLUnspecifiedBinaryProtocolValue().getColumnLength("val"));
}
@Test
@@ -53,9 +54,8 @@ public final class
PostgreSQLUnspecifiedBinaryProtocolValueTest {
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertWrite() {
- new
PostgreSQLUnspecifiedBinaryProtocolValue().write(mock(PostgreSQLPacketPayload.class),
"val");
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLUnspecifiedBinaryProtocolValue().write(mock(PostgreSQLPacketPayload.class),
"val"));
}
-
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLCloseCompletePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLCloseCompletePacketTest.java
index 85321e0122d..98e1522d393 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLCloseCompletePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLCloseCompletePacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
index 3821a46ebd5..29347ae34c6 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
@@ -21,16 +21,17 @@ import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProt
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComClosePacketTest {
@Mock
@@ -61,8 +62,8 @@ public final class PostgreSQLComClosePacketTest {
assertThat(actual, is(PostgreSQLCommandPacketType.CLOSE_COMMAND));
}
- @Test(expected = PostgreSQLProtocolException.class)
+ @Test
public void assertInvalidType() {
- new PostgreSQLComClosePacket(payload);
+ assertThrows(PostgreSQLProtocolException.class, () -> new
PostgreSQLComClosePacket(payload));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/describe/PostgreSQLComDescribePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/describe/PostgreSQLComDescribePacketTest.java
index 9d4b8d2c070..520fe4595a8 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/describe/PostgreSQLComDescribePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/describe/PostgreSQLComDescribePacketTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComDescribePacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/execute/PostgreSQLComExecutePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/execute/PostgreSQLComExecutePacketTest.java
index 3b7db543bbd..46862d953b7 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/execute/PostgreSQLComExecutePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/execute/PostgreSQLComExecutePacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComExecutePacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
index f7a9c986723..336e0fb5f66 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
@@ -20,10 +20,10 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.util.List;
@@ -31,7 +31,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComParsePacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLParseCompletePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLParseCompletePacketTest.java
index 2bfff74d2ad..863567198b5 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLParseCompletePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLParseCompletePacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/sync/PostgreSQLComSyncPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/sync/PostgreSQLComSyncPacketTest.java
index 7bc45512129..852800821f9 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/sync/PostgreSQLComSyncPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/sync/PostgreSQLComSyncPacketTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.ex
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComSyncPacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java
index 16bd3dc9a8c..f0d93904acc 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.si
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLComQueryPacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLAuthenticationOKPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLAuthenticationOKPacketTest.java
index 1c6cf389ffa..1251c8a84f6 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLAuthenticationOKPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLAuthenticationOKPacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLAuthenticationOKPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComStartupPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComStartupPacketTest.java
index 0558cbf6fc5..fa26ac873af 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComStartupPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComStartupPacketTest.java
@@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLComStartupPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComTerminationPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComTerminationPacketTest.java
index 66ac5b2542a..9fb365d8219 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComTerminationPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLComTerminationPacketTest.java
@@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java
index 45650a54478..1a73c5526e2 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.generic;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
index b6e99fee861..1f31f975d1a 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLErrorResponsePacketTest.java
@@ -17,20 +17,20 @@
package org.apache.shardingsphere.db.protocol.postgresql.packet.generic;
-import
org.apache.shardingsphere.dialect.postgresql.vendor.PostgreSQLVendorError;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import
org.apache.shardingsphere.dialect.postgresql.vendor.PostgreSQLVendorError;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PostgreSQLErrorResponsePacketTest {
@Mock
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLMD5PasswordAuthenticationPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLMD5PasswordAuthenticationPacketTest.java
index 87640c3e641..c4347909510 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLMD5PasswordAuthenticationPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLMD5PasswordAuthenticationPacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.authentication.PostgreSQLMD5PasswordAuthenticationPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLParameterStatusPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLParameterStatusPacketTest.java
index 6e6e261354e..477acf77b43 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLParameterStatusPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLParameterStatusPacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLParameterStatusPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLPasswordMessagePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLPasswordMessagePacketTest.java
index e15ef5d1c94..755645b586e 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLPasswordMessagePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLPasswordMessagePacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLPasswordMessagePacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLReadyForQueryPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLReadyForQueryPacketTest.java
index 10af9b1665a..2c304d2b4bf 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLReadyForQueryPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLReadyForQueryPacketTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.generic;
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLSSLNegativePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLSSLNegativePacketTest.java
index 278c187c37c..374bcb5d22b 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLSSLNegativePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLSSLNegativePacketTest.java
@@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLSSLNegativePacket;
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/handshake/PostgreSQLRandomGeneratorTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/handshake/PostgreSQLRandomGeneratorTest.java
index d0d5b9a3616..264eeaa3f41 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/handshake/PostgreSQLRandomGeneratorTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/handshake/PostgreSQLRandomGeneratorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.db.protocol.postgresql.packet.handshake;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
index dff9755d67e..c1cde52cc57 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.db.protocol.postgresql.packet.identifier;
import
org.apache.shardingsphere.db.protocol.postgresql.exception.PostgreSQLProtocolException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class PostgreSQLMessagePacketTypeTest {
@@ -30,8 +31,8 @@ public final class PostgreSQLMessagePacketTypeTest {
assertThat(PostgreSQLMessagePacketType.valueOf(PostgreSQLMessagePacketType.AUTHENTICATION_REQUEST.getValue()),
is(PostgreSQLMessagePacketType.AUTHENTICATION_REQUEST));
}
- @Test(expected = PostgreSQLProtocolException.class)
+ @Test
public void assertGetValueWithIllegalArgument() {
- PostgreSQLMessagePacketType.valueOf(-1);
+ assertThrows(PostgreSQLProtocolException.class, () ->
PostgreSQLMessagePacketType.valueOf(-1));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/payload/PostgreSQLPacketPayloadTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/payload/PostgreSQLPacketPayloadTest.java
index a93dfb4e9f9..fd606fcc1cd 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/payload/PostgreSQLPacketPayloadTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/payload/PostgreSQLPacketPayloadTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.postgresql.payload;
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;