1
0
mirror of synced 2025-12-29 14:50:03 +08:00

修复代理没有设置时会存在的问题

This commit is contained in:
Binary Wang
2016-09-16 21:52:40 +08:00
parent b26a01767d
commit 21f14971c1
4 changed files with 51 additions and 43 deletions

View File

@@ -1,12 +1,14 @@
package me.chanjar.weixin.cp.api;
import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.StringUtils;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.StringUtils;
/**
* 基础API测试
*
@@ -20,7 +22,7 @@ public class WxCpBaseAPITest {
protected WxCpServiceImpl wxService;
public void testRefreshAccessToken() throws WxErrorException {
WxCpConfigStorage configStorage = this.wxService.wxCpConfigStorage;
WxCpConfigStorage configStorage = this.wxService.configStorage;
String before = configStorage.getAccessToken();
this.wxService.getAccessToken(false);

View File

@@ -1,11 +1,13 @@
package me.chanjar.weixin.cp.api;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import com.google.inject.Inject;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpMessage;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
/***
* 测试发送消息
@@ -20,7 +22,7 @@ public class WxCpMessageAPITest {
protected WxCpServiceImpl wxService;
public void testSendCustomMessage() throws WxErrorException {
ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.wxCpConfigStorage;
ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.configStorage;
WxCpMessage message1 = new WxCpMessage();
message1.setAgentId(configStorage.getAgentId());
message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
@@ -32,7 +34,7 @@ public class WxCpMessageAPITest {
.TEXT()
.agentId(configStorage.getAgentId())
.toUser(configStorage.getUserId())
.content("欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>")
.content("欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>")
.build();
this.wxService.messageSend(message2);