@Test
	public void testApolloFactoryBean() throws Exception {
		ApolloDataSourceFactoryBean factoryBean = spy(new ApolloDataSourceFactoryBean());

		Converter converter = mock(JsonConverter.class);

		factoryBean.setDefaultFlowRuleValue(defaultFlowValue);
		factoryBean.setFlowRulesKey(flowRuleKey);
		factoryBean.setNamespaceName(namespace);
		factoryBean.setConverter(converter);

		ApolloDataSource apolloDataSource = mock(ApolloDataSource.class);

		when(apolloDataSource.readSource()).thenReturn("{}");
		doReturn(apolloDataSource).when(factoryBean).getObject();

		assertThat(factoryBean.getObject()).isEqualTo(apolloDataSource);
		assertThat(factoryBean.getObject().readSource()).isEqualTo("{}");
		assertThat(factoryBean.getConverter()).isEqualTo(converter);
		assertThat(factoryBean.getFlowRulesKey()).isEqualTo(flowRuleKey);
		assertThat(factoryBean.getNamespaceName()).isEqualTo(namespace);
		assertThat(factoryBean.getDefaultFlowRuleValue()).isEqualTo(defaultFlowValue);
	}
@author <a href="mailto:fangjian0423@gmail.com">Jim</a>
spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-datasource/src/test/java/com/alibaba/cloud/sentinel/datasource/ApolloDataSourceFactoryBeanTests.java