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/03/14 08:56:35 UTC

[dubbo] branch master updated: [Optimize] constant names should be all uppercase (#6760)

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 97cb435  [Optimize] constant names should be all uppercase (#6760)
97cb435 is described below

commit 97cb4352b26377735ca6cf9b690d2f09522bba20
Author: 罐子里的茶 <93...@qq.com>
AuthorDate: Sun Mar 14 16:56:18 2021 +0800

    [Optimize] constant names should be all uppercase (#6760)
---
 .../configcenter/ConfigChangedEventTest.java       | 30 +++++++++++-----------
 .../spring/registry/MockRegistryFactory.java       |  8 +++---
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java
index 9154927..7725399 100644
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java
@@ -28,28 +28,28 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
  */
 public class ConfigChangedEventTest {
 
-    private static final String key = "k";
+    private static final String KEY = "k";
 
-    private static final String group = "g";
+    private static final String GROUP = "g";
 
-    private static final String content = "c";
+    private static final String CONTENT = "c";
 
     @Test
     public void testGetter() {
 
-        ConfigChangedEvent event = new ConfigChangedEvent(key, group, content);
+        ConfigChangedEvent event = new ConfigChangedEvent(KEY, GROUP, CONTENT);
 
-        assertEquals(key, event.getKey());
-        assertEquals(group, event.getGroup());
-        assertEquals(content, event.getContent());
+        assertEquals(KEY, event.getKey());
+        assertEquals(GROUP, event.getGroup());
+        assertEquals(CONTENT, event.getContent());
         assertEquals(ConfigChangeType.MODIFIED, event.getChangeType());
         assertEquals("k,g", event.getSource());
 
-        event = new ConfigChangedEvent(key, group, content, ConfigChangeType.ADDED);
+        event = new ConfigChangedEvent(KEY, GROUP, CONTENT, ConfigChangeType.ADDED);
 
-        assertEquals(key, event.getKey());
-        assertEquals(group, event.getGroup());
-        assertEquals(content, event.getContent());
+        assertEquals(KEY, event.getKey());
+        assertEquals(GROUP, event.getGroup());
+        assertEquals(CONTENT, event.getContent());
         assertEquals(ConfigChangeType.ADDED, event.getChangeType());
         assertEquals("k,g", event.getSource());
     }
@@ -57,15 +57,15 @@ public class ConfigChangedEventTest {
     @Test
     public void testEqualsAndHashCode() {
         for (ConfigChangeType type : ConfigChangeType.values()) {
-            assertEquals(new ConfigChangedEvent(key, group, content, type), new ConfigChangedEvent(key, group, content, type));
-            assertEquals(new ConfigChangedEvent(key, group, content, type).hashCode(), new ConfigChangedEvent(key, group, content, type).hashCode());
-            assertEquals(new ConfigChangedEvent(key, group, content, type).toString(), new ConfigChangedEvent(key, group, content, type).toString());
+            assertEquals(new ConfigChangedEvent(KEY, GROUP, CONTENT, type), new ConfigChangedEvent(KEY, GROUP, CONTENT, type));
+            assertEquals(new ConfigChangedEvent(KEY, GROUP, CONTENT, type).hashCode(), new ConfigChangedEvent(KEY, GROUP, CONTENT, type).hashCode());
+            assertEquals(new ConfigChangedEvent(KEY, GROUP, CONTENT, type).toString(), new ConfigChangedEvent(KEY, GROUP, CONTENT, type).toString());
         }
     }
 
     @Test
     public void testToString() {
-        ConfigChangedEvent event = new ConfigChangedEvent(key, group, content);
+        ConfigChangedEvent event = new ConfigChangedEvent(KEY, GROUP, CONTENT);
         assertNotNull(event.toString());
     }
 }
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockRegistryFactory.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockRegistryFactory.java
index 8d8eb77..66f225c 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockRegistryFactory.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockRegistryFactory.java
@@ -26,20 +26,20 @@ import java.util.Map;
 
 public class MockRegistryFactory implements RegistryFactory {
 
-    private static final Map<URL, Registry> registries = new HashMap<URL, Registry>();
+    private static final Map<URL, Registry> REGISTRIES = new HashMap<URL, Registry>();
 
     public static Collection<Registry> getCachedRegistry() {
-        return registries.values();
+        return REGISTRIES.values();
     }
 
     public static void cleanCachedRegistry() {
-        registries.clear();
+        REGISTRIES.clear();
     }
 
     @Override
     public Registry getRegistry(URL url) {
         MockRegistry registry = new MockRegistry(url);
-        registries.put(url, registry);
+        REGISTRIES.put(url, registry);
         return registry;
     }
 }