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 f162cf2f726 Use junit 5 on mysql protocol module (#24362)
f162cf2f726 is described below
commit f162cf2f72610c1ebde95ed03f71d52e7bc20be0
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Feb 28 08:10:10 2023 +0800
Use junit 5 on mysql protocol module (#24362)
* Use junit 5 on mysql protocol module
* Add MockResourceAutoReleaseExtension
* Add MockResourceAutoReleaseExtension
* Add MockResourceAutoReleaseExtension
---
.../db/protocol/codec/PacketCodecTest.java | 12 ++---
.../protocol/netty/ChannelAttrInitializerTest.java | 2 +-
.../mysql/codec/MySQLPacketCodecEngineTest.java | 19 ++++----
.../mysql/constant/MySQLBinaryColumnTypeTest.java | 11 +++--
.../mysql/constant/MySQLBinlogEventFlagTest.java | 2 +-
.../mysql/constant/MySQLBinlogEventTypeTest.java | 6 +--
.../mysql/constant/MySQLCapabilityFlagTest.java | 2 +-
.../mysql/constant/MySQLCharacterSetTest.java | 11 +++--
.../constant/MySQLNewParametersBoundFlagTest.java | 7 +--
.../mysql/constant/MySQLServerInfoTest.java | 2 +-
.../mysql/constant/MySQLStatusFlagTest.java | 7 +--
.../packet/binlog/MySQLBinlogEventHeaderTest.java | 8 ++--
...ySQLBinlogFormatDescriptionEventPacketTest.java | 8 ++--
.../MySQLBinlogRotateEventPacketTest.java | 8 ++--
.../binlog/row/MySQLBinlogRowsEventPacketTest.java | 16 +++----
.../row/MySQLBinlogTableMapEventPacketTest.java | 12 ++---
.../value/MySQLBinlogProtocolValueFactoryTest.java | 7 +--
.../blob/MySQLBlobBinlogProtocolValueTest.java | 17 +++----
.../MySQLDecimalBinlogProtocolValueTest.java | 13 ++---
.../MySQLDoubleBinlogProtocolValueTest.java | 8 ++--
.../decimal/MySQLFloatBinlogProtocolValueTest.java | 8 ++--
.../integer/MySQLBitBinlogProtocolValueTest.java | 12 ++---
.../integer/MySQLInt24BinlogProtocolValueTest.java | 8 ++--
.../integer/MySQLLongBinlogProtocolValueTest.java | 8 ++--
.../MySQLLongLongBinlogProtocolValueTest.java | 8 ++--
.../integer/MySQLShortBinlogProtocolValueTest.java | 8 ++--
.../integer/MySQLTinyBinlogProtocolValueTest.java | 8 ++--
.../string/MySQLJsonBinlogProtocolValueTest.java | 20 ++++----
.../value/string/MySQLJsonValueDecoderTest.java | 4 +-
.../string/MySQLStringBinlogProtocolValueTest.java | 21 +++++----
.../MySQLVarcharBinlogProtocolValueTest.java | 12 ++---
.../time/MySQLDateBinlogProtocolValueTest.java | 8 ++--
.../MySQLDatetime2BinlogProtocolValueTest.java | 12 ++---
.../time/MySQLDatetimeBinlogProtocolValueTest.java | 8 ++--
.../time/MySQLTime2BinlogProtocolValueTest.java | 12 ++---
.../time/MySQLTimeBinlogProtocolValueTest.java | 8 ++--
.../column/value/time/MySQLTimeValueUtilTest.java | 2 +-
.../MySQLTimestamp2BinlogProtocolValueTest.java | 12 ++---
.../MySQLTimestampBinlogProtocolValueTest.java | 10 ++--
.../time/MySQLYearBinlogProtocolValueTest.java | 8 ++--
.../command/MySQLCommandPacketTypeLoaderTest.java | 7 +--
.../command/MySQLMySQLCommandPacketTypeTest.java | 7 +--
.../command/admin/MySQLComSetOptionPacketTest.java | 2 +-
.../admin/MySQLUnsupportedCommandPacketTest.java | 8 ++--
.../admin/initdb/MySQLComInitDbPacketTest.java | 8 ++--
.../command/admin/ping/MySQLComPingPacketTest.java | 8 ++--
.../command/admin/quit/MySQLComQuitPacketTest.java | 8 ++--
.../MySQLComBinlogDumpCommandPacketTest.java | 8 ++--
.../MySQLComRegisterSlaveCommandPacketTest.java | 8 ++--
.../query/MySQLColumnDefinition41PacketTest.java | 8 ++--
.../command/query/MySQLFieldCountPacketTest.java | 8 ++--
.../binary/MySQLComStmtSendLongDataPacketTest.java | 2 +-
.../binary/close/MySQLComStmtClosePacketTest.java | 8 ++--
.../execute/MySQLBinaryResultSetRowPacketTest.java | 8 ++--
.../execute/MySQLComStmtExecutePacketTest.java | 6 +--
.../query/binary/execute/MySQLNullBitmapTest.java | 12 ++---
.../protocol/MySQLDateBinaryProtocolValueTest.java | 21 +++++----
.../MySQLDoubleBinaryProtocolValueTest.java | 8 ++--
.../MySQLFloatBinaryProtocolValueTest.java | 8 ++--
.../protocol/MySQLInt1BinaryProtocolValueTest.java | 8 ++--
.../protocol/MySQLInt2BinaryProtocolValueTest.java | 8 ++--
.../protocol/MySQLInt4BinaryProtocolValueTest.java | 8 ++--
.../protocol/MySQLInt8BinaryProtocolValueTest.java | 8 ++--
.../MySQLMySQLBinaryProtocolValueFactoryTest.java | 9 ++--
.../MySQLStringLenencBinaryProtocolValueTest.java | 8 ++--
.../protocol/MySQLTimeBinaryProtocolValueTest.java | 15 +++---
.../MySQLComStmtPrepareMySQLOKPacketTest.java | 8 ++--
.../prepare/MySQLComStmtPreparePacketTest.java | 8 ++--
.../binary/reset/MySQLComStmtResetPacketTest.java | 8 ++--
.../text/MySQLTextResultSetRowPacketTest.java | 8 ++--
.../fieldlist/MySQLComFieldListPacketTest.java | 8 ++--
.../query/text/query/MySQLComQueryPacketTest.java | 8 ++--
.../mysql/packet/generic/MySQLEofPacketTest.java | 8 ++--
.../mysql/packet/generic/MySQLErrPacketTest.java | 8 ++--
.../mysql/packet/generic/MySQLOKPacketTest.java | 8 ++--
.../MySQLAuthSwitchRequestPacketTest.java | 8 ++--
.../MySQLAuthSwitchResponsePacketTest.java | 8 ++--
.../MySQLAuthenticationPluginDataTest.java | 2 +-
.../packet/handshake/MySQLHandshakePacketTest.java | 8 ++--
.../MySQLHandshakeResponse41PacketTest.java | 10 ++--
.../packet/handshake/MySQLRandomGeneratorTest.java | 2 +-
.../mysql/payload/MySQLPacketPayloadTest.java | 20 ++++----
.../context/BackendExecutorContextTest.java | 15 +++---
test/util/pom.xml | 18 +++++++
.../mock/MockResourceAutoReleaseExtension.java | 55 ++++++++++++++++++++++
.../test/mock/StaticMockSettings.java | 28 +++++++----
86 files changed, 471 insertions(+), 367 deletions(-)
diff --git
a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/codec/PacketCodecTest.java
b/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/codec/PacketCodecTest.java
index 0b1eb344c4c..a28548fd6e0 100644
---
a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/codec/PacketCodecTest.java
+++
b/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/codec/PacketCodecTest.java
@@ -20,11 +20,11 @@ package org.apache.shardingsphere.db.protocol.codec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-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 java.util.Collections;
@@ -33,7 +33,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class PacketCodecTest {
@Mock
@@ -47,7 +47,7 @@ public final class PacketCodecTest {
private PacketCodec packetCodec;
- @Before
+ @BeforeEach
public void setUp() {
packetCodec = new PacketCodec(databasePacketCodecEngine);
}
diff --git
a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
b/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
index df6f8d1a840..004b2af276a 100644
---
a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
+++
b/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.db.protocol.netty;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.constant.CommonConstants;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.Charset;
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngineTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngineTest.java
index 2b14aa5179b..2c2199c039d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngineTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngineTest.java
@@ -26,12 +26,14 @@ import io.netty.util.AttributeKey;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants;
import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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;
@@ -43,8 +45,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doThrow;
@@ -52,7 +54,8 @@ 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 MySQLPacketCodecEngineTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -61,7 +64,7 @@ public final class MySQLPacketCodecEngineTest {
@Mock
private ByteBuf byteBuf;
- @Before
+ @BeforeEach
public void setup() {
when(context.channel().attr(AttributeKey.<Charset>valueOf(Charset.class.getName())).get()).thenReturn(StandardCharsets.UTF_8);
when(context.channel().attr(MySQLConstants.MYSQL_SEQUENCE_ID).get()).thenReturn(new
AtomicInteger());
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
index 5056bef710f..face446e139 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
@@ -17,12 +17,13 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
-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 MySQLBinaryColumnTypeTest {
@@ -51,9 +52,9 @@ public final class MySQLBinaryColumnTypeTest {
assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BLOB),
is(MySQLBinaryColumnType.MYSQL_TYPE_BLOB));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertValueOfJDBCIllegalArgument() {
- MySQLBinaryColumnType.valueOfJDBCType(9999);
+ assertThrows(IllegalArgumentException.class, () ->
MySQLBinaryColumnType.valueOfJDBCType(9999));
}
@Test
@@ -61,8 +62,8 @@ public final class MySQLBinaryColumnTypeTest {
assertThat(MySQLBinaryColumnType.valueOf(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL.getValue()),
is(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertValueOfWithIllegalArgument() {
- MySQLBinaryColumnType.valueOf(-1);
+ assertThrows(IllegalArgumentException.class, () ->
MySQLBinaryColumnType.valueOf(-1));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
index de64e815fd9..e60e30cac39 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.db.protocol.mysql.constant;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public final class MySQLBinlogEventFlagTest {
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventTypeTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventTypeTest.java
index fc29cb1f52d..67fee3bb903 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventTypeTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventTypeTest.java
@@ -17,14 +17,14 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class MySQLBinlogEventTypeTest {
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java
index 3d433dd3faa..f9e603d7569 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
-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/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCharacterSetTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCharacterSetTest.java
index 1bb0277db9a..863c2c577d2 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCharacterSetTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCharacterSetTest.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
import
org.apache.shardingsphere.dialect.mysql.exception.UnknownCollationException;
-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 MySQLCharacterSetTest {
@@ -31,13 +32,13 @@ public final class MySQLCharacterSetTest {
assertThat(actual, is(MySQLCharacterSet.UTF8MB4_GENERAL_CI));
}
- @Test(expected = UnknownCollationException.class)
+ @Test
public void assertCharacterSetNotFoundById() {
- MySQLCharacterSet.findById(-1);
+ assertThrows(UnknownCollationException.class, () ->
MySQLCharacterSet.findById(-1));
}
- @Test(expected = UnknownCollationException.class)
+ @Test
public void assertFoundUnsupportedCharacterSetById() {
- MySQLCharacterSet.findById(63);
+ assertThrows(UnknownCollationException.class, () ->
MySQLCharacterSet.findById(63));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
index 7befc87ae78..f0383a03f9d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
import
org.apache.shardingsphere.db.protocol.mysql.exception.MySQLProtocolException;
-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 MySQLNewParametersBoundFlagTest {
@@ -30,8 +31,8 @@ public final class MySQLNewParametersBoundFlagTest {
assertThat(MySQLNewParametersBoundFlag.valueOf(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST.getValue()),
is(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST));
}
- @Test(expected = MySQLProtocolException.class)
+ @Test
public void assertValueOfWithIllegalArgument() {
- MySQLNewParametersBoundFlag.valueOf(-1);
+ assertThrows(MySQLProtocolException.class, () ->
MySQLNewParametersBoundFlag.valueOf(-1));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java
index 570ade5a17e..fd55ec3465a 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.db.protocol.mysql.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/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
index b0a096a32e8..a30fd09cba6 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnknownSQLException;
-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 MySQLStatusFlagTest {
@@ -35,8 +36,8 @@ public final class MySQLStatusFlagTest {
assertThat(MySQLStatusFlag.valueOf(0x0001),
is(MySQLStatusFlag.SERVER_STATUS_IN_TRANS));
}
- @Test(expected = UnknownSQLException.class)
+ @Test
public void assertValueOfByIntegerFailure() {
- MySQLStatusFlag.valueOf(0x0011);
+ assertThrows(UnknownSQLException.class, () ->
MySQLStatusFlag.valueOf(0x0011));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/MySQLBinlogEventHeaderTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/MySQLBinlogEventHeaderTest.java
index e576e6a779c..7a555ff1808 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/MySQLBinlogEventHeaderTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/MySQLBinlogEventHeaderTest.java
@@ -20,17 +20,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinlogEventFlag;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinlogEventType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLBinlogEventHeaderTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogFormatDescriptionEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogFormatDescriptionEventPacketTest.java
index 988ce693b6f..90d46cdd5fc 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogFormatDescriptionEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogFormatDescriptionEventPacketTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.management;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.MySQLBinlogEventHeader;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLBinlogFormatDescriptionEventPacketTest {
private static final String MYSQL_SERVER_VERSION = "5.7.14-log" + new
String(new byte[40]);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogRotateEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogRotateEventPacketTest.java
index 42d63fcb0d9..44c4414ff67 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogRotateEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/management/MySQLBinlogRotateEventPacketTest.java
@@ -20,10 +20,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.management;
import io.netty.buffer.Unpooled;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.MySQLBinlogEventHeader;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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;
@@ -31,7 +31,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLBinlogRotateEventPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
index 6252745ef48..e9bffcbcbbe 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
@@ -22,12 +22,12 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnTyp
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.MySQLBinlogEventHeader;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.internal.configuration.plugins.Plugins;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -37,13 +37,13 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLBinlogRowsEventPacketTest {
@Mock
@@ -57,7 +57,7 @@ public final class MySQLBinlogRowsEventPacketTest {
private List<MySQLBinlogColumnDef> columnDefs;
- @Before
+ @BeforeEach
public void setUp() {
mockColumnDefs();
when(payload.readInt6()).thenReturn(1L);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
index 238c5a7ba26..3f82561e357 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
@@ -23,22 +23,22 @@ import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.MySQLBinlogEven
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.MySQLNullBitmap;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.Collection;
import java.util.Iterator;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLBinlogTableMapEventPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
index f2ff8a58bd0..b2a3671a9f9 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
@@ -19,10 +19,11 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.integer.MySQLTinyBinlogProtocolValue;
-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 MySQLBinlogProtocolValueFactoryTest {
@@ -31,8 +32,8 @@ public final class MySQLBinlogProtocolValueFactoryTest {
assertThat(MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TINY),
instanceOf(MySQLTinyBinlogProtocolValue.class));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertGetBinlogProtocolValueFailure() {
-
MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_GEOMETRY);
+ assertThrows(IllegalArgumentException.class, () ->
MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_GEOMETRY));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
index c31ae0376ab..5ae9e1d6af3 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
@@ -22,17 +22,18 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnTyp
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-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 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 MySQLBlobBinlogProtocolValueTest {
@Mock
@@ -43,7 +44,7 @@ public final class MySQLBlobBinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_STRING);
}
@@ -83,9 +84,9 @@ public final class MySQLBlobBinlogProtocolValueTest {
assertThat(new MySQLBlobBinlogProtocolValue().read(columnDef,
payload), is(new byte[255]));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertReadWithUnknownMetaValue() {
columnDef.setColumnMeta(5);
- new MySQLBlobBinlogProtocolValue().read(columnDef, payload);
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLBlobBinlogProtocolValue().read(columnDef, payload));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
index 14b9150280e..6cb7109f91b 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
@@ -21,18 +21,19 @@ import io.netty.buffer.ByteBufUtil;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 java.math.BigDecimal;
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 MySQLDecimalBinlogProtocolValueTest {
@Mock
@@ -40,7 +41,7 @@ public final class MySQLDecimalBinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL);
columnDef.setColumnMeta((14 << 8) + 4);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
index fbcebfec5cf..619873cf7bb 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLDoubleBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
index 46c0cc487d4..28ca6a974b3 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLFloatBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLBitBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLBitBinlogProtocolValueTest.java
index 9d390cfa64c..a80f3ddb13d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLBitBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLBitBinlogProtocolValueTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 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 MySQLBitBinlogProtocolValueTest {
@Mock
@@ -40,7 +40,7 @@ public final class MySQLBitBinlogProtocolValueTest {
private MySQLBitBinlogProtocolValue actual;
- @Before
+ @BeforeEach
public void setUp() {
actual = new MySQLBitBinlogProtocolValue();
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLInt24BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLInt24BinlogProtocolValueTest.java
index 1f9b63995d8..4ee74329c85 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLInt24BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLInt24BinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLInt24BinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongBinlogProtocolValueTest.java
index d7950da0b8e..a80f7d7ee09 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongBinlogProtocolValueTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLLongBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongLongBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongLongBinlogProtocolValueTest.java
index 67ee0deaf04..0da845d8574 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongLongBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLLongLongBinlogProtocolValueTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLLongLongBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLShortBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLShortBinlogProtocolValueTest.java
index ea3819f1bf0..8d7ff49352d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLShortBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLShortBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLShortBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLTinyBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLTinyBinlogProtocolValueTest.java
index c3bf526a9d9..e89369a5725 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLTinyBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/integer/MySQLTinyBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLTinyBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
index 3d8dd083d3c..3bf949efa41 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
@@ -23,17 +23,21 @@ import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQ
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.string.MySQLJsonValueDecoder.JsonValueTypes;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-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 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)
+@MockitoSettings(strictness = Strictness.LENIENT)
public final class MySQLJsonBinlogProtocolValueTest {
private static final String KEY = "key";
@@ -51,7 +55,7 @@ public final class MySQLJsonBinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MySQL_TYPE_JSON);
when(payload.getByteBuf()).thenReturn(byteBuf);
@@ -101,9 +105,9 @@ public final class MySQLJsonBinlogProtocolValueTest {
assertThat(new MySQLJsonBinlogProtocolValue().read(columnDef,
payload), is(EXPECTED_JSON));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertReadJsonValueWithIllegalMeta() {
columnDef.setColumnMeta(5);
- new MySQLJsonBinlogProtocolValue().read(columnDef, payload);
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLJsonBinlogProtocolValue().read(columnDef, payload));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java
index 81cbfe6160a..577dde17a5c 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java
@@ -20,10 +20,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import com.google.common.base.Strings;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.string.MySQLJsonValueDecoder.JsonValueTypes;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.junit.Test;
+import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.string.MySQLJsonValueDecoder.JsonValueTypes;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.LinkedList;
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
index 9497c0a3e25..24002fae717 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
@@ -22,17 +22,18 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnTyp
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-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 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 MySQLStringBinlogProtocolValueTest {
@Mock
@@ -43,7 +44,7 @@ public final class MySQLStringBinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_STRING);
}
@@ -62,10 +63,10 @@ public final class MySQLStringBinlogProtocolValueTest {
assertThat(new MySQLStringBinlogProtocolValue().read(columnDef,
payload), is(32767));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertReadEnumValueWithMetaFailure() {
columnDef.setColumnMeta((MySQLBinaryColumnType.MYSQL_TYPE_ENUM.getValue() << 8)
+ 3);
- new MySQLStringBinlogProtocolValue().read(columnDef, payload);
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLStringBinlogProtocolValue().read(columnDef, payload));
}
@Test
@@ -96,9 +97,9 @@ public final class MySQLStringBinlogProtocolValueTest {
assertThat(new MySQLStringBinlogProtocolValue().read(columnDef,
payload), is(expected));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertReadValueWithUnknownType() {
columnDef.setColumnMeta(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING.getValue()
<< 8);
- new MySQLStringBinlogProtocolValue().read(columnDef, payload);
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLStringBinlogProtocolValue().read(columnDef, payload));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
index a8806585faf..7f429c01b04 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
@@ -21,17 +21,17 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 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 MySQLVarcharBinlogProtocolValueTest {
@Mock
@@ -42,7 +42,7 @@ public final class MySQLVarcharBinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR);
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
index 3e0de44d620..a1ca2b2b0a7 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLDateBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
index 09c160c8f6e..f1176f787b4 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
@@ -21,17 +21,17 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 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 MySQLDatetime2BinlogProtocolValueTest {
@Mock
@@ -42,7 +42,7 @@ public final class MySQLDatetime2BinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME2);
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
index a5f0599842c..b6f65333ac7 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLDatetimeBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
index 11ae07e8775..cdef42deb56 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
@@ -21,17 +21,17 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 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 MySQLTime2BinlogProtocolValueTest {
@Mock
@@ -42,7 +42,7 @@ public final class MySQLTime2BinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_TIME2);
columnDef.setColumnMeta(0);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
index f4a745fd10c..a81e06dc70f 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLTimeBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
index 6bf5aea513e..5d304af4553 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.time;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
index 424b370e455..45bc36a1d49 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
@@ -21,11 +21,11 @@ import io.netty.buffer.ByteBuf;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 java.sql.Timestamp;
@@ -33,7 +33,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 MySQLTimestamp2BinlogProtocolValueTest {
@Mock
@@ -44,7 +44,7 @@ public final class MySQLTimestamp2BinlogProtocolValueTest {
private MySQLBinlogColumnDef columnDef;
- @Before
+ @BeforeEach
public void setUp() {
columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP2);
when(payload.getByteBuf()).thenReturn(byteBuf);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
index caefde6a934..b21e75bb313 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLTimestampBinlogProtocolValueTest {
@Mock
@@ -41,7 +41,7 @@ public final class MySQLTimestampBinlogProtocolValueTest {
@Test
public void assertRead() {
- int currentSeconds = new Long(System.currentTimeMillis() /
1000).intValue();
+ int currentSeconds = Long.valueOf(System.currentTimeMillis() /
1000).intValue();
when(payload.readInt4()).thenReturn(currentSeconds);
assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef,
payload), is(MySQLTimeValueUtil.getSimpleDateFormat().format(new
Timestamp(currentSeconds * 1000L))));
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
index a188477361e..6be09ba3c96 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
@@ -19,16 +19,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLYearBinlogProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
index b8a5505fb0e..0a1300ec95d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoaderTest.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.command;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -34,10 +35,10 @@ public final class MySQLCommandPacketTypeLoaderTest {
assertThat(MySQLCommandPacketTypeLoader.getCommandPacketType(payload),
is(MySQLCommandPacketType.COM_QUIT));
}
- @Test(expected = NullPointerException.class)
+ @Test
public void assertGetCommandPacketTypeError() {
MySQLPacketPayload payload = mock(MySQLPacketPayload.class);
when(payload.readInt1()).thenReturn(0x21);
- MySQLCommandPacketTypeLoader.getCommandPacketType(payload);
+ assertThrows(NullPointerException.class, () ->
MySQLCommandPacketTypeLoader.getCommandPacketType(payload));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLMySQLCommandPacketTypeTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLMySQLCommandPacketTypeTest.java
index b3f682138f7..4d1089ad1f5 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLMySQLCommandPacketTypeTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLMySQLCommandPacketTypeTest.java
@@ -17,10 +17,11 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.command;
-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 MySQLMySQLCommandPacketTypeTest {
@@ -29,8 +30,8 @@ public final class MySQLMySQLCommandPacketTypeTest {
assertThat(MySQLCommandPacketType.valueOf(MySQLCommandPacketType.COM_SLEEP.getValue()),
is(MySQLCommandPacketType.COM_SLEEP));
}
- @Test(expected = NullPointerException.class)
+ @Test
public void assertGetValueWithIllegalArgument() {
- MySQLCommandPacketType.valueOf(-1);
+ assertThrows(NullPointerException.class, () ->
MySQLCommandPacketType.valueOf(-1));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLComSetOptionPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLComSetOptionPacketTest.java
index 914b9c12f58..0756a7a6933 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLComSetOptionPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLComSetOptionPacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.admin;
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLUnsupportedCommandPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLUnsupportedCommandPacketTest.java
index f7f5b7be657..f158cfa2738 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLUnsupportedCommandPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/MySQLUnsupportedCommandPacketTest.java
@@ -19,12 +19,12 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.admin;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLUnsupportedCommandPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/initdb/MySQLComInitDbPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/initdb/MySQLComInitDbPacketTest.java
index 33425e10c7e..c0c66d58bd1 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/initdb/MySQLComInitDbPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/initdb/MySQLComInitDbPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.admin.initdb;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComInitDbPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/ping/MySQLComPingPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/ping/MySQLComPingPacketTest.java
index c3d12256f00..734f48693be 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/ping/MySQLComPingPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/ping/MySQLComPingPacketTest.java
@@ -19,14 +19,14 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.admin.ping;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLComPingPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/quit/MySQLComQuitPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/quit/MySQLComQuitPacketTest.java
index 3dddfda3898..096ad618649 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/quit/MySQLComQuitPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/admin/quit/MySQLComQuitPacketTest.java
@@ -19,14 +19,14 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.admin.quit;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLComQuitPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComBinlogDumpCommandPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComBinlogDumpCommandPacketTest.java
index 3b85b3c5cb0..67f7787bbf0 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComBinlogDumpCommandPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComBinlogDumpCommandPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.binlog;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComBinlogDumpCommandPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComRegisterSlaveCommandPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComRegisterSlaveCommandPacketTest.java
index 3ab5199d1f5..cd60b57bc00 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComRegisterSlaveCommandPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/binlog/MySQLComRegisterSlaveCommandPacketTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.binlog;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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;
@@ -30,7 +30,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLComRegisterSlaveCommandPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
index 42c8869d3a5..152e5186830 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
@@ -20,16 +20,16 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerInfo;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLColumnDefinition41PacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java
index c14428e4490..1388da9361c 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java
@@ -18,17 +18,17 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.command.query;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLFieldCountPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/MySQLComStmtSendLongDataPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/MySQLComStmtSendLongDataPacketTest.java
index 7a5e820c14c..16886dcb449 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/MySQLComStmtSendLongDataPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/MySQLComStmtSendLongDataPacketTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary;
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/close/MySQLComStmtClosePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/close/MySQLComStmtClosePacketTest.java
index 84ebc48adca..1c61a5a41ac 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/close/MySQLComStmtClosePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/close/MySQLComStmtClosePacketTest.java
@@ -18,16 +18,16 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.close;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComStmtClosePacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
index c9e85fa66ac..44fa24c0d53 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
@@ -21,16 +21,16 @@ import
org.apache.shardingsphere.db.protocol.binary.BinaryCell;
import org.apache.shardingsphere.db.protocol.binary.BinaryRow;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.Arrays;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLBinaryResultSetRowPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
index 516f37f6253..8a67006abcb 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnTyp
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLNewParametersBoundFlag;
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.MySQLPreparedStatementParameterType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
@@ -30,9 +30,9 @@ import java.util.Collections;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
-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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public final class MySQLComStmtExecutePacketTest {
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLNullBitmapTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLNullBitmapTest.java
index bb2ad655ffa..a5d63ff00f9 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLNullBitmapTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLNullBitmapTest.java
@@ -18,18 +18,18 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLNullBitmapTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
index 4f04de8b621..5e79ebe0f04 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
@@ -18,10 +18,10 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.protocol;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.SQLException;
import java.sql.SQLFeatureNotSupportedException;
@@ -30,18 +30,19 @@ import java.util.Calendar;
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.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLDateBinaryProtocolValueTest {
@Mock
private MySQLPacketPayload payload;
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertReadWithZeroByte() throws SQLException {
- new MySQLDateBinaryProtocolValue().read(payload, false);
+ @Test
+ public void assertReadWithZeroByte() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new
MySQLDateBinaryProtocolValue().read(payload, false));
}
@Test
@@ -86,10 +87,10 @@ public final class MySQLDateBinaryProtocolValueTest {
assertThat(actualTimestamp.getNanos(), is(232323000));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertReadWithIllegalArgument() throws SQLException {
+ @Test
+ public void assertReadWithIllegalArgument() {
when(payload.readInt1()).thenReturn(100);
- new MySQLDateBinaryProtocolValue().read(payload, false);
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new
MySQLDateBinaryProtocolValue().read(payload, false));
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
index 5e4757fbf5c..5b4322fc2dd 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.
import io.netty.buffer.ByteBuf;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLDoubleBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
index f0a1b9c09fd..bfa2f7fe46b 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
@@ -19,10 +19,10 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.
import io.netty.buffer.ByteBuf;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLFloatBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValueTest.java
index 457c541d611..3ab4215b28c 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValueTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLInt1BinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValueTest.java
index 303aaafc66c..7d8798332a9 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValueTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLInt2BinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValueTest.java
index 08bb13b92ec..5aecb0ea78b 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValueTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLInt4BinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt8BinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt8BinaryProtocolValueTest.java
index a4c8d6f89cd..c8f37ea2ca2 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt8BinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt8BinaryProtocolValueTest.java
@@ -18,10 +18,10 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.protocol;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.math.BigDecimal;
@@ -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 MySQLInt8BinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
index 854b7bdefe3..6059f173457 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
@@ -18,11 +18,12 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.protocol;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
public final class MySQLMySQLBinaryProtocolValueFactoryTest {
@@ -156,8 +157,8 @@ public final class MySQLMySQLBinaryProtocolValueFactoryTest
{
assertNull(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_NULL));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void assertGetBinaryProtocolValueWithUnsupportedType() {
- MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(null);
+ assertThrows(IllegalArgumentException.class, () ->
MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(null));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLStringLenencBinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLStringLenencBinaryProtocolValueTest.java
index d8a42d051c4..df35a62a3b1 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLStringLenencBinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLStringLenencBinaryProtocolValueTest.java
@@ -18,17 +18,17 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.protocol;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLStringLenencBinaryProtocolValueTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
index 44419371e5a..829b2d07e2d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
@@ -18,10 +18,10 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.protocol;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.SQLException;
import java.sql.SQLFeatureNotSupportedException;
@@ -31,12 +31,13 @@ import java.util.Calendar;
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.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLTimeBinaryProtocolValueTest {
@Mock
@@ -67,10 +68,10 @@ public final class MySQLTimeBinaryProtocolValueTest {
assertThat(actual.get(Calendar.SECOND), is(0));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertReadWithIllegalArgument() throws SQLException {
+ @Test
+ public void assertReadWithIllegalArgument() {
when(payload.readInt1()).thenReturn(100);
- new MySQLTimeBinaryProtocolValue().read(payload, false);
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new
MySQLTimeBinaryProtocolValue().read(payload, false));
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPrepareMySQLOKPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPrepareMySQLOKPacketTest.java
index 7199b45e8b3..ebebb880846 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPrepareMySQLOKPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPrepareMySQLOKPacketTest.java
@@ -18,15 +18,15 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.prepare;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLComStmtPrepareMySQLOKPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java
index 3a888e28084..911d9e08097 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java
@@ -18,17 +18,17 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.prepare;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComStmtPreparePacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
index 8e91ce0ea11..75d5ca2c8dd 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
@@ -18,14 +18,14 @@
package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.reset;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.Mockito.verify;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLComStmtResetPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
index af01343832d..9bbc1c3b4b0 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.command.query.text;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.math.BigDecimal;
import java.sql.Timestamp;
@@ -34,7 +34,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLTextResultSetRowPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/fieldlist/MySQLComFieldListPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/fieldlist/MySQLComFieldListPacketTest.java
index ea039bd9fe1..df231df5b68 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/fieldlist/MySQLComFieldListPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/fieldlist/MySQLComFieldListPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.text.fi
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComFieldListPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java
index f55b1186965..d400419c2f5 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.command.query.text.qu
import
org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLComQueryPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLEofPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLEofPacketTest.java
index 5ba6905878d..030a5483744 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLEofPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLEofPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.generic;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLStatusFlag;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLEofPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
index 7258c64c28a..03a96c88a7d 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.generic;
import org.apache.shardingsphere.dialect.mysql.vendor.MySQLVendorError;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLErrPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLOKPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLOKPacketTest.java
index b634519952d..133f1ab53a0 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLOKPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLOKPacketTest.java
@@ -19,17 +19,17 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.generic;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLStatusFlag;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLOKPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
index bfb08c49e5d..9cd41c09d15 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
@@ -18,17 +18,17 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.handshake;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLAuthSwitchRequestPacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacketTest.java
index d4344390d83..ef25a1aebb4 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacketTest.java
@@ -18,16 +18,16 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.handshake;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLAuthSwitchResponsePacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthenticationPluginDataTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthenticationPluginDataTest.java
index 9a7c59ff32b..969df79242b 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthenticationPluginDataTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthenticationPluginDataTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.db.protocol.mysql.packet.handshake;
import com.google.common.primitives.Bytes;
-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/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
index 94410453a19..b7c1dd1fe1c 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
@@ -22,17 +22,17 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerInfo;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLStatusFlag;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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 MySQLHandshakePacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java
index ed1e931bd8a..cdb1448f30e 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java
@@ -21,18 +21,18 @@ import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationM
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerInfo;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
-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.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLHandshakeResponse41PacketTest {
@Mock
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLRandomGeneratorTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLRandomGeneratorTest.java
index 8b79eb69bf8..830e670b1d4 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLRandomGeneratorTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLRandomGeneratorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.db.protocol.mysql.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/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java
index b1055d7f418..0da1ce5b9e1 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.db.protocol.mysql.payload;
import io.netty.buffer.ByteBuf;
-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.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public final class MySQLPacketPayloadTest {
@Mock
@@ -151,23 +151,23 @@ public final class MySQLPacketPayloadTest {
@Test
public void assertWriteIntLenencWithTwoBytes() {
- new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(new Double(Math.pow(2, 16)).longValue()
- 1);
+ new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2,
16)).longValue() - 1);
verify(byteBuf).writeByte(0xfc);
- verify(byteBuf).writeShortLE(new Double(Math.pow(2, 16)).intValue() -
1);
+ verify(byteBuf).writeShortLE(Double.valueOf(Math.pow(2,
16)).intValue() - 1);
}
@Test
public void assertWriteIntLenencWithThreeBytes() {
- new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(new Double(Math.pow(2, 24)).longValue()
- 1);
+ new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2,
24)).longValue() - 1);
verify(byteBuf).writeByte(0xfd);
- verify(byteBuf).writeMediumLE(new Double(Math.pow(2, 24)).intValue() -
1);
+ verify(byteBuf).writeMediumLE(Double.valueOf(Math.pow(2,
24)).intValue() - 1);
}
@Test
public void assertWriteIntLenencWithFourBytes() {
- new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(new Double(Math.pow(2, 25)).longValue()
- 1);
+ new MySQLPacketPayload(byteBuf,
StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2,
25)).longValue() - 1);
verify(byteBuf).writeByte(0xfe);
- verify(byteBuf).writeLongLE(new Double(Math.pow(2, 25)).intValue() -
1);
+ verify(byteBuf).writeLongLE(Double.valueOf(Math.pow(2, 25)).intValue()
- 1);
}
@Test
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
index 8729e5e567a..ff0edc67e0d 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
@@ -21,25 +21,26 @@ import
org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
-import org.junit.Test;
-import org.mockito.MockedStatic;
+import org.apache.shardingsphere.test.mock.MockResourceAutoReleaseExtension;
+import org.apache.shardingsphere.test.mock.StaticMockSettings;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;
+@ExtendWith(MockResourceAutoReleaseExtension.class)
+@StaticMockSettings(ProxyContext.class)
public final class BackendExecutorContextTest {
@Test
public void assertGetInstance() {
ContextManager contextManager = mockContextManager();
- try (MockedStatic<ProxyContext> proxyContext =
mockStatic(ProxyContext.class, RETURNS_DEEP_STUBS)) {
- proxyContext.when(() ->
ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
-
assertThat(BackendExecutorContext.getInstance().getExecutorEngine(),
is(BackendExecutorContext.getInstance().getExecutorEngine()));
- }
+
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
+ assertThat(BackendExecutorContext.getInstance().getExecutorEngine(),
is(BackendExecutorContext.getInstance().getExecutorEngine()));
}
private ContextManager mockContextManager() {
diff --git a/test/util/pom.xml b/test/util/pom.xml
index a7dfe9dfb05..59c38d34f62 100644
--- a/test/util/pom.xml
+++ b/test/util/pom.xml
@@ -26,4 +26,22 @@
</parent>
<artifactId>shardingsphere-test-util</artifactId>
<name>${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/test/util/src/main/java/org/apache/shardingsphere/test/mock/MockResourceAutoReleaseExtension.java
b/test/util/src/main/java/org/apache/shardingsphere/test/mock/MockResourceAutoReleaseExtension.java
new file mode 100644
index 00000000000..d0969ee33ca
--- /dev/null
+++
b/test/util/src/main/java/org/apache/shardingsphere/test/mock/MockResourceAutoReleaseExtension.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.mock;
+
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.mockito.MockedStatic;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.mockStatic;
+
+/**
+ * Mock resource auto release extension.
+ */
+public final class MockResourceAutoReleaseExtension implements
BeforeEachCallback, AfterEachCallback {
+
+ private final Collection<MockedStatic<?>> mockedStatics = new
LinkedList<>();
+
+ @Override
+ public void beforeEach(final ExtensionContext context) {
+ StaticMockSettings staticMockSettings =
context.getRequiredTestClass().getAnnotation(StaticMockSettings.class);
+ if (null != staticMockSettings) {
+ for (Class<?> each : staticMockSettings.value()) {
+ mockedStatics.add(mockStatic(each, RETURNS_DEEP_STUBS));
+ }
+ }
+ }
+
+ @Override
+ public void afterEach(final ExtensionContext context) {
+ for (MockedStatic<?> each : mockedStatics) {
+ each.close();
+ }
+ mockedStatics.clear();
+ }
+}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
b/test/util/src/main/java/org/apache/shardingsphere/test/mock/StaticMockSettings.java
similarity index 60%
copy from
db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
copy to
test/util/src/main/java/org/apache/shardingsphere/test/mock/StaticMockSettings.java
index de64e815fd9..f757d6590a0 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinlogEventFlagTest.java
+++
b/test/util/src/main/java/org/apache/shardingsphere/test/mock/StaticMockSettings.java
@@ -15,17 +15,27 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.mysql.constant;
+package org.apache.shardingsphere.test.mock;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
-import org.junit.Test;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
-public final class MySQLBinlogEventFlagTest {
+/**
+ * Static mock settings.
+ */
+@ExtendWith(MockitoExtension.class)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StaticMockSettings {
- @Test
- public void assertGetValue() {
- assertThat(MySQLBinlogEventFlag.LOG_EVENT_MTS_ISOLATE_F.getValue(),
is(0x0200));
- }
+ /**
+ * Mock classes.
+ *
+ * @return mock classes
+ */
+ Class<?>[] value();
}