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 59329e91a1e [Issue #20401]-Added unit test for 
YamlSQLParserCacheOptionConfigurationSwapper (#20768)
59329e91a1e is described below

commit 59329e91a1e514a48ae94a79f6766283ff3c5ede
Author: Abhinav Koppula <[email protected]>
AuthorDate: Mon Sep 5 05:08:15 2022 +0530

    [Issue #20401]-Added unit test for 
YamlSQLParserCacheOptionConfigurationSwapper (#20768)
---
 ...LParserCacheOptionConfigurationSwapperTest.java | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

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
new file mode 100644
index 00000000000..723e63d0172
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserCacheOptionConfigurationSwapperTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.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;
+
+public final class YamlSQLParserCacheOptionConfigurationSwapperTest {
+    
+    private final YamlSQLParserCacheOptionConfigurationSwapper 
configurationSwapper = new YamlSQLParserCacheOptionConfigurationSwapper();
+    
+    private final CacheOption expectedData = new CacheOption(2, 5);
+    
+    private final YamlSQLParserCacheOptionRuleConfiguration 
expectedConfiguration = new YamlSQLParserCacheOptionRuleConfiguration();
+    
+    @Before
+    public void setup() {
+        
expectedConfiguration.setInitialCapacity(expectedData.getInitialCapacity());
+        expectedConfiguration.setMaximumSize(expectedData.getMaximumSize());
+    }
+    
+    @Test
+    public void testSwapToYamlConfiguration() {
+        YamlSQLParserCacheOptionRuleConfiguration actualResponse = 
configurationSwapper.swapToYamlConfiguration(expectedData);
+        assertEquals(expectedConfiguration.getInitialCapacity(), 
actualResponse.getInitialCapacity());
+        assertEquals(expectedConfiguration.getMaximumSize(), 
actualResponse.getMaximumSize());
+    }
+    
+    @Test
+    public void testSwapToObject() {
+        CacheOption actualResponse = 
configurationSwapper.swapToObject(expectedConfiguration);
+        assertEquals(expectedData.getInitialCapacity(), 
actualResponse.getInitialCapacity());
+        assertEquals(expectedData.getMaximumSize(), 
actualResponse.getMaximumSize());
+    }
+}

Reply via email to