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

tuichenchuxin 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 774b38fa6bf Refactor YamlSQLParserCacheOptionConfigurationSwapperTest 
(#20779)
774b38fa6bf is described below

commit 774b38fa6bfa5ebf7b56f907a63e9c84952284d9
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Mon Sep 5 09:04:04 2022 +0800

    Refactor YamlSQLParserCacheOptionConfigurationSwapperTest (#20779)
---
 ...LParserCacheOptionConfigurationSwapperTest.java | 31 +++++++++++-----------
 .../mode/metadata/MetaDataContextsFactoryTest.java |  2 +-
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git 
a/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserCacheOptionConfigurationSwapperTest.java
 
b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserCacheOptionConfigurationSwapperTest.java
index 723e63d0172..6236d9e3d8b 100644
--- 
a/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserCacheOptionConfigurationSwapperTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserCacheOptionConfigurationSwapperTest.java
@@ -17,38 +17,39 @@
 
 package org.apache.shardingsphere.parser.yaml.swapper;
 
-import static org.junit.Assert.assertEquals;
-
 import 
org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration;
 import org.apache.shardingsphere.sql.parser.api.CacheOption;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
 public final class YamlSQLParserCacheOptionConfigurationSwapperTest {
     
-    private final YamlSQLParserCacheOptionConfigurationSwapper 
configurationSwapper = new YamlSQLParserCacheOptionConfigurationSwapper();
+    private final YamlSQLParserCacheOptionConfigurationSwapper 
cacheOptionConfigurationSwapper = new 
YamlSQLParserCacheOptionConfigurationSwapper();
     
-    private final CacheOption expectedData = new CacheOption(2, 5);
+    private final CacheOption cacheOption = new CacheOption(2, 5);
     
-    private final YamlSQLParserCacheOptionRuleConfiguration 
expectedConfiguration = new YamlSQLParserCacheOptionRuleConfiguration();
+    private final YamlSQLParserCacheOptionRuleConfiguration 
cacheOptionRuleConfiguration = new YamlSQLParserCacheOptionRuleConfiguration();
     
     @Before
     public void setup() {
-        
expectedConfiguration.setInitialCapacity(expectedData.getInitialCapacity());
-        expectedConfiguration.setMaximumSize(expectedData.getMaximumSize());
+        
cacheOptionRuleConfiguration.setInitialCapacity(cacheOption.getInitialCapacity());
+        
cacheOptionRuleConfiguration.setMaximumSize(cacheOption.getMaximumSize());
     }
     
     @Test
-    public void testSwapToYamlConfiguration() {
-        YamlSQLParserCacheOptionRuleConfiguration actualResponse = 
configurationSwapper.swapToYamlConfiguration(expectedData);
-        assertEquals(expectedConfiguration.getInitialCapacity(), 
actualResponse.getInitialCapacity());
-        assertEquals(expectedConfiguration.getMaximumSize(), 
actualResponse.getMaximumSize());
+    public void assertSwapToYamlConfiguration() {
+        YamlSQLParserCacheOptionRuleConfiguration actual = 
cacheOptionConfigurationSwapper.swapToYamlConfiguration(cacheOption);
+        assertThat(actual.getInitialCapacity(), is(2));
+        assertThat(actual.getMaximumSize(), is(5L));
     }
     
     @Test
-    public void testSwapToObject() {
-        CacheOption actualResponse = 
configurationSwapper.swapToObject(expectedConfiguration);
-        assertEquals(expectedData.getInitialCapacity(), 
actualResponse.getInitialCapacity());
-        assertEquals(expectedData.getMaximumSize(), 
actualResponse.getMaximumSize());
+    public void assertSwapToObject() {
+        CacheOption actual = 
cacheOptionConfigurationSwapper.swapToObject(cacheOptionRuleConfiguration);
+        assertThat(actual.getInitialCapacity(), is(2));
+        assertThat(actual.getMaximumSize(), is(5L));
     }
 }
diff --git 
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactoryTest.java
 
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactoryTest.java
index 91bffc9a296..29bd3511609 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactoryTest.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactoryTest.java
@@ -96,7 +96,7 @@ public final class MetaDataContextsFactoryTest {
     }
     
     private ContextManagerBuilderParameter 
createContextManagerBuilderParameter() {
-        return new ContextManagerBuilderParameter(null, 
+        return new ContextManagerBuilderParameter(null,
                 Collections.singletonMap("foo_db", 
mock(DataSourceGeneratedDatabaseConfiguration.class)), Collections.emptyList(), 
new Properties(), Collections.emptyList(), null);
     }
 }

Reply via email to