1
0
mirror of synced 2025-12-22 00:48:00 +08:00

#289 增加临时二维码的场景值支持字符串的接口

* 更新接口:临时二维码的场景值支持字符串

* 新增临时二维码的场景值为字符串的单元测试
This commit is contained in:
Hyseen
2017-07-26 14:34:57 +08:00
committed by Binary Wang
parent b9c9b844c8
commit 30b5a9aa8f
3 changed files with 61 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
import org.apache.commons.lang3.RandomStringUtils;
import org.testng.*;
import org.testng.annotations.*;
@@ -26,6 +27,11 @@ public class WxMpQrcodeServiceImplTest {
return new Object[][]{{-1}, {0}, {1}, {200000}};
}
@DataProvider
public Object[][] sceneStrs() {
return new Object[][]{{null}, {""}, {"test"}, {RandomStringUtils.randomAlphanumeric(100)}};
}
@Test(dataProvider = "sceneIds")
public void testQrCodeCreateTmpTicket(int sceneId) throws WxErrorException {
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(sceneId, null);
@@ -35,6 +41,16 @@ public class WxMpQrcodeServiceImplTest {
System.out.println(ticket);
}
@Test(dataProvider = "sceneStrs")
public void testQrCodeCreateTmpTicketWithSceneStr(String sceneStr) throws WxErrorException {
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(sceneStr, null);
Assert.assertNotNull(ticket.getUrl());
Assert.assertNotNull(ticket.getTicket());
Assert.assertTrue(ticket.getExpire_seconds() != -1);
System.out.println(ticket);
}
@Test(dataProvider = "sceneIds")
public void testQrCodeCreateLastTicket(int sceneId) throws WxErrorException {
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(sceneId);