You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/10/09 07:46:51 UTC

[dubbo] branch master updated: fix #7808, add some unit test for MetricsConfig (#8977)

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

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 91e5aea  fix #7808, add some unit test for MetricsConfig (#8977)
91e5aea is described below

commit 91e5aea7bc98a79f0636afa097ce9b49d8b6d319
Author: Wang Chengming <63...@qq.com>
AuthorDate: Sat Oct 9 15:46:38 2021 +0800

    fix #7808, add some unit test for MetricsConfig (#8977)
---
 .../org/apache/dubbo/config/MetricsConfigTest.java | 41 ++++++++++++++++++++++
 .../dubbo/config/context/ConfigManagerTest.java    |  4 +--
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dubbo-common/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java b/dubbo-common/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java
new file mode 100644
index 0000000..69b359f
--- /dev/null
+++ b/dubbo-common/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.dubbo.config;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+public class MetricsConfigTest {
+
+    @Test
+    public void testPort() {
+        MetricsConfig metrics = new MetricsConfig();
+        metrics.setPort("8080");
+
+        assertThat(metrics.getPort(), equalTo("8080"));
+    }
+
+    @Test
+    public void testProtocol() throws Exception {
+        MetricsConfig metrics = new MetricsConfig();
+        metrics.setProtocol("protocol");
+
+        assertThat(metrics.getProtocol(), equalTo("protocol"));
+    }
+}
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java
index 24c4f00..df2cd2c 100644
--- a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java
@@ -113,7 +113,7 @@ public class ConfigManagerTest {
 
     // Test MonitorConfig correlative methods
     @Test
-    public void tesModuleConfig() {
+    public void testModuleConfig() {
         ModuleConfig config = new ModuleConfig();
         configManager.setModule(config);
         assertTrue(configManager.getModule().isPresent());
@@ -122,7 +122,7 @@ public class ConfigManagerTest {
 
     // Test MetricsConfig correlative methods
     @Test
-    public void tesMetricsConfig() {
+    public void testMetricsConfig() {
         MetricsConfig config = new MetricsConfig();
         configManager.setMetrics(config);
         assertTrue(configManager.getMetrics().isPresent());