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

duanzhengqiang 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 b916249  Use assertThat to instead of assertEquals. (#12981)
b916249 is described below

commit b91624997d72549fbd58331386750076a52e24fe
Author: yx9o <[email protected]>
AuthorDate: Mon Oct 11 10:46:54 2021 +0800

    Use assertThat to instead of assertEquals. (#12981)
---
 .../transaction/ConnectionTransactionTest.java     | 11 ++++----
 .../ScalingIdleClusterAutoSwitchAlgorithmTest.java | 29 +++++++++++-----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ConnectionTransactionTest.java
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ConnectionTransactionTest.java
index a67c47b..5109719 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ConnectionTransactionTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ConnectionTransactionTest.java
@@ -28,12 +28,13 @@ import org.junit.Test;
 import java.util.Collections;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
 
 public final class ConnectionTransactionTest {
-
+    
     private ConnectionTransaction connectionTransaction;
-
+    
     @Before
     public void init() {
         Map<String, ShardingSphereTransactionManagerEngine> actualEngines = 
Collections.singletonMap(DefaultSchema.LOGIC_NAME, new 
ShardingSphereTransactionManagerEngine());
@@ -44,10 +45,10 @@ public final class ConnectionTransactionTest {
                 transactionContexts
         );
     }
-
+    
     @Test
     public void assertDistributedTransactionOperationTypeIgnore() {
         DistributedTransactionOperationType operationType = 
connectionTransaction.getDistributedTransactionOperationType(false);
-        assertEquals(operationType, 
DistributedTransactionOperationType.IGNORE);
+        assertThat(operationType, 
is(DistributedTransactionOperationType.IGNORE));
     }
 }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingIdleClusterAutoSwitchAlgorithmTest.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingIdleClusterAutoSwitchAlgorithmTest.java
index b2aee3d..ca5106b 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingIdleClusterAutoSwitchAlgorithmTest.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingIdleClusterAutoSwitchAlgorithmTest.java
@@ -17,14 +17,6 @@
 
 package org.apache.shardingsphere.scaling.core.api.impl;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -34,9 +26,18 @@ import org.mockito.MockitoAnnotations;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.springframework.test.util.ReflectionTestUtils;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
 @RunWith(MockitoJUnitRunner.class)
 public final class ScalingIdleClusterAutoSwitchAlgorithmTest {
-
+    
     @Mock
     private Properties propsMock;
     
@@ -47,7 +48,7 @@ public final class ScalingIdleClusterAutoSwitchAlgorithmTest {
         MockitoAnnotations.initMocks(this);
         ReflectionTestUtils.setField(scalingAlgorithm, "props", propsMock);
     }
-
+    
     @Test(expected = IllegalArgumentException.class)
     public void assertInitFailNoIdleThresholdKey() {
         
Mockito.when(propsMock.containsKey(ScalingIdleClusterAutoSwitchAlgorithm.IDLE_THRESHOLD_KEY)).thenReturn(false);
@@ -77,7 +78,7 @@ public final class ScalingIdleClusterAutoSwitchAlgorithmTest {
     
     @Test
     public void assertGetType() {
-        assertEquals(scalingAlgorithm.getType(), "IDLE");
+        assertThat(scalingAlgorithm.getType(), is("IDLE"));
     }
     
     @Test
@@ -92,13 +93,11 @@ public final class 
ScalingIdleClusterAutoSwitchAlgorithmTest {
     
     @Test
     public void assertFalseOnFewPendingIncrementalTasks() {
-        List<Long> tasks = Arrays.asList(10L, 50L);
-        assertFalse(scalingAlgorithm.allIncrementalTasksAlmostFinished(tasks));
+        
assertFalse(scalingAlgorithm.allIncrementalTasksAlmostFinished(Arrays.asList(10L,
 50L)));
     }
     
     @Test
     public void assertTrueWhenAllIncrementalTasksAlmostFinished() {
-        List<Long> tasks = Arrays.asList(60L, 50L, 30L);
-        assertTrue(scalingAlgorithm.allIncrementalTasksAlmostFinished(tasks));
+        
assertTrue(scalingAlgorithm.allIncrementalTasksAlmostFinished(Arrays.asList(60L,
 50L, 30L)));
     }
 }

Reply via email to