You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by yx...@apache.org on 2022/04/04 01:59:48 UTC
[shardingsphere] branch master updated: PropertiesUtil#getRequiredValue need add unit test (#16572)
This is an automated email from the ASF dual-hosted git repository.
yx9o 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 6b01e4b082b PropertiesUtil#getRequiredValue need add unit test (#16572)
6b01e4b082b is described below
commit 6b01e4b082ba8f1a864ef833cd37603292872dd1
Author: 龙台 Long Tai <77...@users.noreply.github.com>
AuthorDate: Mon Apr 4 09:59:32 2022 +0800
PropertiesUtil#getRequiredValue need add unit test (#16572)
* PropertiesUtil#getRequiredValue need add unit test (#16285)
* Add final keyword
* Modify variable naming
* Modify variable naming
---
.../sharding/cosid/PropertiesUtilTest.java | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/PropertiesUtilTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/PropertiesUtilTest.java
new file mode 100644
index 00000000000..c43b44c323c
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/PropertiesUtilTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sharding.algorithm.sharding.cosid;
+
+import org.junit.Test;
+
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class PropertiesUtilTest {
+
+ @Test
+ public void assertGetRequiredValue() {
+ Properties properties = new Properties();
+ properties.setProperty("sql-show", "true");
+ String actual = PropertiesUtil.getRequiredValue(properties, "sql-show");
+ assertThat(actual, is("true"));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void assertGetInvalidRequiredValue() {
+ Properties properties = new Properties();
+ PropertiesUtil.getRequiredValue(properties, "sql-show");
+ }
+}