diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java index f212a5c638f..f1669d3462e 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java @@ -61,14 +61,14 @@ public class RegistryProtocolTest { @Test public void testDefaultPort() { - RegistryProtocol registryProtocol = new RegistryProtocol(); + RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol(); assertEquals(9090, registryProtocol.getDefaultPort()); } @Test public void testExportUrlNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { - RegistryProtocol registryProtocol = new RegistryProtocol(); + RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol(); registryProtocol.setCluster(new FailfastCluster()); Protocol dubboProtocol = DubboProtocol.getDubboProtocol(); @@ -81,7 +81,7 @@ public void testExportUrlNull() { @Test public void testExport() { - RegistryProtocol registryProtocol = new RegistryProtocol(); + RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol(); registryProtocol.setCluster(new FailfastCluster()); registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension()); @@ -165,7 +165,7 @@ public void testDestoryRegistry() { @Test public void testGetParamsToRegistry() { - RegistryProtocol registryProtocol = new RegistryProtocol(); + RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol(); String[] additionalParams = new String[]{"key1", "key2"}; String[] registryParams = registryProtocol.getParamsToRegistry(DEFAULT_REGISTER_PROVIDER_KEYS, additionalParams); String[] expectParams = ArrayUtils.addAll(DEFAULT_REGISTER_PROVIDER_KEYS, additionalParams);