Browse Source

完善模板消息发送的单元测试,加入颜色

master
Binary Wang 8 years ago
parent
commit
1bd4f681b6
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java

+ 4
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java View File

@@ -9,6 +9,7 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.apache.commons.lang3.RandomStringUtils;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -28,7 +29,7 @@ public class WxMpTemplateMsgServiceImplTest {
@Inject
protected WxMpService wxService;

@Test(invocationCount = 10, threadPoolSize = 10)
@Test(invocationCount = 5, threadPoolSize = 3)
public void testSendTemplateMsg() throws WxErrorException {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
@@ -39,6 +40,8 @@ public class WxMpTemplateMsgServiceImplTest {
.templateId(configStorage.getTemplateId()).build();
templateMessage.addWxMpTemplateData(
new WxMpTemplateData("first", dateFormat.format(new Date())));
templateMessage.addWxMpTemplateData(
new WxMpTemplateData("remark", RandomStringUtils.randomAlphanumeric(100), "#FF00FF"));
String msgId = this.wxService.getTemplateMsgService().sendTemplateMsg(templateMessage);
Assert.assertNotNull(msgId);
System.out.println(msgId);


Loading…
Cancel
Save