add unit test for nacos config

pull/288/head
pbting 6 years ago
parent 431b246507
commit 6ca806c313

@ -16,14 +16,14 @@
package org.springframework.cloud.alibaba.nacos; package org.springframework.cloud.alibaba.nacos;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
import org.springframework.cloud.alibaba.nacos.client.NacosPropertySourceLocator; import org.springframework.cloud.alibaba.nacos.client.NacosPropertySourceLocator;
import org.springframework.cloud.alibaba.nacos.refresh.NacosRefreshProperties; import org.springframework.cloud.alibaba.nacos.refresh.NacosRefreshProperties;
import org.springframework.core.env.CompositePropertySource; import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.PropertySource; import org.springframework.core.env.PropertySource;
import static org.assertj.core.api.Assertions.assertThat;
/** /**
* @author xiaojing * @author xiaojing
* @author pbting * @author pbting
@ -61,10 +61,7 @@ public class NacosConfigAutoConfigurationTests extends NacosPowerMockitBaseTests
.getBean(NacosPropertySourceLocator.class); .getBean(NacosPropertySourceLocator.class);
PropertySource propertySource = nacosPropertySourceLocator PropertySource propertySource = nacosPropertySourceLocator
.locate(this.context.getEnvironment()); .locate(this.context.getEnvironment());
assertThat(propertySource instanceof CompositePropertySource).isEqualTo(true); assertThat(propertySource instanceof CompositePropertySource).isEqualTo(true);
CompositePropertySource compositePropertySource = (CompositePropertySource) propertySource;
assertThat(compositePropertySource.containsProperty("user.name")).isEqualTo(true);
} }
@Test @Test

Loading…
Cancel
Save