@Test
	public void testZKWithPathFactoryBean() throws Exception {
		ZookeeperDataSourceFactoryBean factoryBean = spy(
				ZookeeperDataSourceFactoryBean.class);

		Converter converter = mock(XmlConverter.class);

		ZookeeperDataSource zookeeperDataSource = mock(ZookeeperDataSource.class);

		factoryBean.setConverter(converter);
		factoryBean.setPath(path);
		factoryBean.setServerAddr(serverAddr);

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

		assertThat(factoryBean.getObject()).isEqualTo(zookeeperDataSource);
		assertThat(factoryBean.getObject().readSource()).isEqualTo("{}");
		assertThat(factoryBean.getConverter()).isEqualTo(converter);
		assertThat(factoryBean.getPath()).isEqualTo(path);
		assertThat(factoryBean.getServerAddr()).isEqualTo(serverAddr);
	}
@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/ZookeeperDataSourceFactoryBeanTests.java