🆕 #1320 小程序模块增加订阅消息模板设置相关接口

This commit is contained in:
Binary Wang
2019-12-16 00:29:03 +08:00
parent c70706c9aa
commit dd6a1c0529
10 changed files with 322 additions and 12 deletions

View File

@@ -0,0 +1,62 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaSubscribeService;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
/**
* 测试类.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2019-12-15
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaSubscribeServiceImplTest {
@Inject
protected WxMaService wxService;
@Test
public void testGetPubTemplateTitleList() throws WxErrorException {
this.wxService.getSubscribeService().getPubTemplateTitleList(new Integer[]{578}, 1, 1);
}
@Test
public void testGetPubTemplateKeyWordsById() throws WxErrorException {
final List<WxMaSubscribeService.PubTemplateKeyword> result = this.wxService.getSubscribeService().getPubTemplateKeyWordsById("578");
System.out.println(result);
}
@Test
public void testAddTemplate() throws WxErrorException {
final String templateId = this.wxService.getSubscribeService().addTemplate("1", Lists.newArrayList(1), "");
System.out.println(templateId);
}
@Test
public void testGetTemplateList() throws WxErrorException {
final List<WxMaSubscribeService.TemplateInfo> templateList = this.wxService.getSubscribeService().getTemplateList();
System.out.println(templateList);
}
@Test
public void testDelTemplate() throws WxErrorException {
this.wxService.getSubscribeService().delTemplate("priTmplId");
}
@Test
public void testGetCategory() throws WxErrorException {
final List<WxMaSubscribeService.CategoryData> categoryData = this.wxService.getSubscribeService().getCategory();
assertThat(categoryData).isNotNull();
System.out.println(categoryData);
}
}

View File

@@ -17,7 +17,6 @@ import java.util.List;
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaTemplateServiceImplTest {
@Inject
protected WxMaService wxService;
@@ -36,7 +35,7 @@ public class WxMaTemplateServiceImplTest {
}
@Test
public void testAddTemplate() throws Exception{
public void testAddTemplate() throws Exception {
List<Integer> list = Lists.newArrayList();
list.add(1);
list.add(20);
@@ -48,7 +47,7 @@ public class WxMaTemplateServiceImplTest {
}
@Test
public void testFindTemplateList() throws Exception{
public void testFindTemplateList() throws Exception {
WxMaTemplateListResult result = this.wxService.getTemplateService().findTemplateList(0, 20);
System.out.println(result);
}