This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 901688dc9da Use assertThat instead of assertEquals (#35994)
901688dc9da is described below

commit 901688dc9daa59700fa789d74be14b96dc8b7ef3
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jul 14 23:24:28 2025 +0800

    Use assertThat instead of assertEquals (#35994)
---
 .../db/protocol/firebird/constant/FirebirdArchTypeTest.java      | 8 ++++----
 .../constant/FirebirdProtocolDefaultVersionProviderTest.java     | 5 +++--
 .../db/protocol/firebird/constant/FirebirdUserDataTypeTest.java  | 5 +++--
 .../db/protocol/firebird/constant/FirebirdValueFormatTest.java   | 7 ++++---
 .../buffer/type/FirebirdDatabaseParameterBufferTypeTest.java     | 9 +++++----
 .../buffer/type/FirebirdTransactionParameterBufferTypeTest.java  | 7 ++++---
 .../firebird/constant/protocol/FirebirdProtocolVersionTest.java  | 8 +++++---
 .../infra/metadata/statistics/ShardingSphereStatisticsTest.java  | 3 +--
 8 files changed, 29 insertions(+), 23 deletions(-)

diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdArchTypeTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdArchTypeTest.java
index 9647923a8a0..046e9848cd8 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdArchTypeTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdArchTypeTest.java
@@ -19,18 +19,18 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant;
 
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertFalse;
 
 class FirebirdArchTypeTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdArchType.ARCH_INTEL_32, 
FirebirdArchType.valueOf(29));
+        assertThat(FirebirdArchType.valueOf(29), 
is(FirebirdArchType.ARCH_INTEL_32));
         assertThrows(NullPointerException.class, () -> 
FirebirdArchType.valueOf(999));
-        
     }
     
     @Test
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdProtocolDefaultVersionProviderTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdProtocolDefaultVersionProviderTest.java
index c9bc955569f..438c76058f7 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdProtocolDefaultVersionProviderTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdProtocolDefaultVersionProviderTest.java
@@ -19,7 +19,8 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant;
 
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 class FirebirdProtocolDefaultVersionProviderTest {
     
@@ -27,6 +28,6 @@ class FirebirdProtocolDefaultVersionProviderTest {
     
     @Test
     void assertGetDatabaseTypeReturnsFirebird() {
-        assertEquals("Firebird", provider.getDatabaseType());
+        assertThat(provider.getDatabaseType(), is("Firebird"));
     }
 }
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdUserDataTypeTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdUserDataTypeTest.java
index 2e25646c58d..fb956a5543f 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdUserDataTypeTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdUserDataTypeTest.java
@@ -19,14 +19,15 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant;
 
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 class FirebirdUserDataTypeTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdUserDataType.CNCT_USER, 
FirebirdUserDataType.valueOf(1));
+        assertThat(FirebirdUserDataType.valueOf(1), 
is(FirebirdUserDataType.CNCT_USER));
         assertThrows(NullPointerException.class, () -> 
FirebirdUserDataType.valueOf(999));
     }
 }
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdValueFormatTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdValueFormatTest.java
index 76cd15efe4e..9fb0581662f 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdValueFormatTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/FirebirdValueFormatTest.java
@@ -20,15 +20,16 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant;
 import 
org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 class FirebirdValueFormatTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdValueFormat.TEXT, FirebirdValueFormat.valueOf(0));
-        assertEquals(FirebirdValueFormat.BINARY, 
FirebirdValueFormat.valueOf(1));
+        assertThat(FirebirdValueFormat.valueOf(0), 
is(FirebirdValueFormat.TEXT));
+        assertThat(FirebirdValueFormat.valueOf(1), 
is(FirebirdValueFormat.BINARY));
         assertThrows(UnsupportedSQLOperationException.class, () -> 
FirebirdValueFormat.valueOf(999));
     }
 }
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdDatabaseParameterBufferTypeTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdDatabaseParameterBufferTypeTest.java
index 38850d9a2b3..6f87063bac7 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdDatabaseParameterBufferTypeTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdDatabaseParameterBufferTypeTest.java
@@ -20,17 +20,18 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant.buffer.type;
 import 
org.apache.shardingsphere.db.protocol.firebird.constant.buffer.FirebirdParameterBuffer;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class FirebirdDatabaseParameterBufferTypeTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdDatabaseParameterBufferType.PAGE_SIZE, 
FirebirdDatabaseParameterBufferType.valueOf(4));
+        assertThat(FirebirdDatabaseParameterBufferType.valueOf(4), 
is(FirebirdDatabaseParameterBufferType.PAGE_SIZE));
         assertThrows(NullPointerException.class, () -> 
FirebirdDatabaseParameterBufferType.valueOf(999));
     }
     
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdTransactionParameterBufferTypeTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdTransactionParameterBufferTypeTest.java
index 21517526459..0c7fc4a13eb 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdTransactionParameterBufferTypeTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/buffer/type/FirebirdTransactionParameterBufferTypeTest.java
@@ -19,16 +19,17 @@ package 
org.apache.shardingsphere.db.protocol.firebird.constant.buffer.type;
 
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 class FirebirdTransactionParameterBufferTypeTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdTransactionParameterBufferType.CONSISTENCY, 
FirebirdTransactionParameterBufferType.valueOf(1));
+        assertThat(FirebirdTransactionParameterBufferType.valueOf(1), 
is(FirebirdTransactionParameterBufferType.CONSISTENCY));
         assertThrows(NullPointerException.class, () -> 
FirebirdTransactionParameterBufferType.valueOf(999));
     }
     
diff --git 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/protocol/FirebirdProtocolVersionTest.java
 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/protocol/FirebirdProtocolVersionTest.java
index f4ce9936b9a..dcbbacd65de 100644
--- 
a/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/protocol/FirebirdProtocolVersionTest.java
+++ 
b/db-protocol/firebird/src/test/java/org/apache/shardingsphere/db/protocol/firebird/constant/protocol/FirebirdProtocolVersionTest.java
@@ -18,15 +18,17 @@
 package org.apache.shardingsphere.db.protocol.firebird.constant.protocol;
 
 import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 class FirebirdProtocolVersionTest {
     
     @Test
     void assertValueOf() {
-        assertEquals(FirebirdProtocolVersion.PROTOCOL_VERSION10, 
FirebirdProtocolVersion.valueOf(10));
-        assertEquals(FirebirdProtocolVersion.PROTOCOL_VERSION19, 
FirebirdProtocolVersion.valueOf(0x8000 | 19));
+        assertThat(FirebirdProtocolVersion.valueOf(10), 
is(FirebirdProtocolVersion.PROTOCOL_VERSION10));
+        assertThat(FirebirdProtocolVersion.valueOf(0x8000 | 19), 
is(FirebirdProtocolVersion.PROTOCOL_VERSION19));
         assertThrows(NullPointerException.class, () -> 
FirebirdProtocolVersion.valueOf(999));
     }
 }
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/ShardingSphereStatisticsTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/ShardingSphereStatisticsTest.java
index ae7ce144001..6df59b92e09 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/ShardingSphereStatisticsTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/ShardingSphereStatisticsTest.java
@@ -21,7 +21,6 @@ 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.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -39,7 +38,7 @@ class ShardingSphereStatisticsTest {
         ShardingSphereStatistics statistics = new ShardingSphereStatistics();
         DatabaseStatistics databaseStatistics = new DatabaseStatistics();
         statistics.putDatabaseStatistics(TEST_DATABASE_NAME, 
databaseStatistics);
-        assertEquals(statistics.getDatabaseStatistics(TEST_DATABASE_NAME), 
databaseStatistics);
+        assertThat(databaseStatistics, 
is(statistics.getDatabaseStatistics(TEST_DATABASE_NAME)));
         
assertNull(statistics.getDatabaseStatistics(NON_EXISTENT_DATABASE_NAME));
     }
     

Reply via email to