ShardingSphereAlgorithmBeanRegistry { public static Map<String, RuntimeBeanReference> getAlgorithmBeanReferences(final ParserContext parserContext, final Class<? extends ShardingSphereAlgorithmFactoryBean<?>> algorithmFactoryBeanClass) { String[] beanDefinitionNames = parserContext.getRegistry().getBeanDefinitionNames(); String algorithmFactoryBeanClassName = algorithmFactoryBeanClass.getName(); Map<String, RuntimeBeanReference> result = new ManagedMap<>(beanDefinitionNames.length); for (String each : beanDefinitionNames) { if (parserContext.getRegistry().getBeanDefinition(each).getBeanClassName().equals(algorithmFactoryBeanClassName)) { result.put(each, new RuntimeBeanReference(each)); } } return result; }  static Map<String, RuntimeBeanReference> getAlgorithmBeanReferences(final ParserContext parserContext, 
                                                                               final Class<? extends ShardingSphereAlgorithmFactoryBean<?>> algorithmFactoryBeanClass);  }
@Test public void assertGetAlgorithmBeanReferences() { ParserContext parserContext = mock(ParserContext.class, RETURNS_DEEP_STUBS); when(parserContext.getRegistry().getBeanDefinitionNames()).thenReturn(new String[] {"includeBean", "excludeBean"}); when(parserContext.getRegistry().getBeanDefinition("includeBean").getBeanClassName()).thenReturn(ShardingSphereAlgorithmFixtureFactoryBean.class.getName()); when(parserContext.getRegistry().getBeanDefinition("excludeBean").getBeanClassName()).thenReturn(Object.class.getName()); Map<String, RuntimeBeanReference> actual = ShardingSphereAlgorithmBeanRegistry.getAlgorithmBeanReferences(parserContext, ShardingSphereAlgorithmFixtureFactoryBean.class); assertThat(actual.size(), is(1)); assertThat(actual.get("includeBean").getBeanName(), is("includeBean")); }