添加对发送模板消息的单元测试

This commit is contained in:
BinaryWang
2016-09-28 11:12:01 +08:00
parent a5757774cb
commit cb9380cc4f
14 changed files with 164 additions and 77 deletions

View File

@@ -257,9 +257,8 @@ public class WxMpServiceImpl implements WxMpService {
@Override
public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send";
String responseContent = execute(new SimplePostRequestExecutor(), url, templateMessage.toJson());
JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent);
final JsonObject jsonObject = tmpJsonElement.getAsJsonObject();
String responseContent = this.post(url, templateMessage.toJson());
final JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject();
if (jsonObject.get("errcode").getAsInt() == 0){
return jsonObject.get("msgid").getAsString();
}