1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

update nacos-config test case

This commit is contained in:
fangjian0423 2019-04-16 16:57:33 +08:00
parent ca23643cd3
commit 2d2ffd3560

View File

@ -96,13 +96,11 @@ public class NacosConfigurationTests {
public Object invoke(Object proxy, Method method, Object[] args) public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable { throws Throwable {
if ("test-name.properties".equals(args[0]) if ("test-name.properties".equals(args[0])) {
&& "test-group".equals(args[1])) {
return "user.nacos-age=1"; return "user.nacos-age=1";
} }
if ("test-name-dev.properties".equals(args[0]) if ("test-name-dev.properties".equals(args[0])) {
&& "test-group".equals(args[1])) {
return "user.nacos-name=dev"; return "user.nacos-name=dev";
} }
@ -149,7 +147,7 @@ public class NacosConfigurationTests {
private NacosRefreshHistory refreshHistory; private NacosRefreshHistory refreshHistory;
@Test @Test
public void contextLoads() throws Exception { public void contextLoads() {
assertNotNull("NacosPropertySourceLocator was not created", locator); assertNotNull("NacosPropertySourceLocator was not created", locator);
assertNotNull("NacosConfigProperties was not created", properties); assertNotNull("NacosConfigProperties was not created", properties);
@ -237,11 +235,11 @@ public class NacosConfigurationTests {
private void checkoutDataLoad() { private void checkoutDataLoad() {
Assert.assertEquals(environment.getProperty("user.nacos-name"), "dev"); Assert.assertEquals("dev", environment.getProperty("user.nacos-name"));
Assert.assertEquals(environment.getProperty("user.nacos-age"), "1"); Assert.assertEquals("1", environment.getProperty("user.nacos-age"));
} }
private void checkoutEndpoint() throws Exception { private void checkoutEndpoint() {
NacosConfigEndpoint nacosConfigEndpoint = new NacosConfigEndpoint(properties, NacosConfigEndpoint nacosConfigEndpoint = new NacosConfigEndpoint(properties,
refreshHistory); refreshHistory);
Map<String, Object> map = nacosConfigEndpoint.invoke(); Map<String, Object> map = nacosConfigEndpoint.invoke();