### Question:
ConfigCenter { @Bean @DependsOn("governanceConfiguration") Registry getRegistry() { Registry registry = null; if (registryUrl == null) { if (StringUtils.isBlank(registryAddress)) { throw new ConfigurationException("Either config center or registry address is needed, please refer to https: } registryUrl = formUrl(registryAddress, registryGroup, username, password); } RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); registry = registryFactory.getRegistry(registryUrl); return registry; }    }### Answer:
@Test public void testGetRegistry() throws Exception { try { configCenter.getRegistry(); fail("should throw exception when registryAddress is blank"); } catch (ConfigurationException e) { } assertNull(ReflectionTestUtils.getField(configCenter, "registryUrl")); ReflectionTestUtils.setField(configCenter, "registryAddress", zkAddress); ReflectionTestUtils.setField(configCenter, "registryGroup", "dubbo"); ReflectionTestUtils.setField(configCenter, "username", "username"); ReflectionTestUtils.setField(configCenter, "password", "password"); configCenter.getRegistry(); Object registryUrl = ReflectionTestUtils.getField(configCenter, "registryUrl"); assertNotNull(registryUrl); assertEquals("127.0.0.1", ((URL) registryUrl).getHost()); }