### Question:
ConfigCenter { @Bean @DependsOn("governanceConfiguration") MetaDataCollector getMetadataCollector() { MetaDataCollector metaDataCollector = new NoOpMetadataCollector(); if (metadataUrl == null) { if (StringUtils.isNotEmpty(metadataAddress)) { metadataUrl = formUrl(metadataAddress, metadataGroup, username, password); metadataUrl = metadataUrl.addParameter(CLUSTER_KEY, cluster); } } if (metadataUrl != null) { metaDataCollector = ExtensionLoader.getExtensionLoader(MetaDataCollector.class).getExtension(metadataUrl.getProtocol()); metaDataCollector.setUrl(metadataUrl); metaDataCollector.init(); } else { logger.warn("you are using dubbo.registry.address, which is not recommend, please refer to: https: } return metaDataCollector; }    }### Answer:
@Test public void testGetMetadataCollector() throws Exception { ReflectionTestUtils.setField(configCenter, "metadataAddress", ""); configCenter.getMetadataCollector(); assertNull(ReflectionTestUtils.getField(configCenter, "metadataUrl")); ReflectionTestUtils.setField(configCenter, "metadataAddress", zkAddress); ReflectionTestUtils.setField(configCenter, "metadataGroup", "dubbo"); ReflectionTestUtils.setField(configCenter, "username", "username"); ReflectionTestUtils.setField(configCenter, "password", "password"); configCenter.getMetadataCollector(); Object metadataUrl = ReflectionTestUtils.getField(configCenter, "metadataUrl"); assertNotNull(metadataUrl); assertEquals("127.0.0.1", ((URL) metadataUrl).getHost()); }