Skip to content

Commit 1706807

Browse files
OrDTestersralf0131
authored andcommitted
Changing tests to use singleton RegistryProtocol instead of making new instances (apache#3849)
1 parent a0f3408 commit 1706807

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ public class RegistryProtocolTest {
6161

6262
@Test
6363
public void testDefaultPort() {
64-
RegistryProtocol registryProtocol = new RegistryProtocol();
64+
RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol();
6565
assertEquals(9090, registryProtocol.getDefaultPort());
6666
}
6767

6868
@Test
6969
public void testExportUrlNull() {
7070
Assertions.assertThrows(IllegalArgumentException.class, () -> {
71-
RegistryProtocol registryProtocol = new RegistryProtocol();
71+
RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol();
7272
registryProtocol.setCluster(new FailfastCluster());
7373

7474
Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
@@ -81,7 +81,7 @@ public void testExportUrlNull() {
8181

8282
@Test
8383
public void testExport() {
84-
RegistryProtocol registryProtocol = new RegistryProtocol();
84+
RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol();
8585
registryProtocol.setCluster(new FailfastCluster());
8686
registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension());
8787

@@ -165,7 +165,7 @@ public void testDestoryRegistry() {
165165

166166
@Test
167167
public void testGetParamsToRegistry() {
168-
RegistryProtocol registryProtocol = new RegistryProtocol();
168+
RegistryProtocol registryProtocol = RegistryProtocol.getRegistryProtocol();
169169
String[] additionalParams = new String[]{"key1", "key2"};
170170
String[] registryParams = registryProtocol.getParamsToRegistry(DEFAULT_REGISTER_PROVIDER_KEYS, additionalParams);
171171
String[] expectParams = ArrayUtils.addAll(DEFAULT_REGISTER_PROVIDER_KEYS, additionalParams);

0 commit comments

Comments
 (0)