生成带参数的二维码时加入场景值的校验 #106
This commit is contained in:
@@ -6,6 +6,7 @@ import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -19,20 +20,26 @@ import java.io.File;
|
||||
@Test(groups = "qrCodeAPI")
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMpQrCodeServiceImplTest {
|
||||
|
||||
@Inject
|
||||
protected WxMpService wxService;
|
||||
|
||||
public void testQrCodeCreateTmpTicket() throws WxErrorException {
|
||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(1, null);
|
||||
@DataProvider
|
||||
public Object[][] sceneIds() {
|
||||
return new Object[][]{{-1}, {0}, {1}, {200000}};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "sceneIds")
|
||||
public void testQrCodeCreateTmpTicket(int sceneId) throws WxErrorException {
|
||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(sceneId, null);
|
||||
Assert.assertNotNull(ticket.getUrl());
|
||||
Assert.assertNotNull(ticket.getTicket());
|
||||
Assert.assertTrue(ticket.getExpire_seconds() != -1);
|
||||
System.out.println(ticket);
|
||||
}
|
||||
|
||||
public void testQrCodeCreateLastTicket() throws WxErrorException {
|
||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(1);
|
||||
@Test(dataProvider = "sceneIds")
|
||||
public void testQrCodeCreateLastTicket(int sceneId) throws WxErrorException {
|
||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(sceneId);
|
||||
Assert.assertNotNull(ticket.getUrl());
|
||||
Assert.assertNotNull(ticket.getTicket());
|
||||
Assert.assertTrue(ticket.getExpire_seconds() == -1);
|
||||
|
||||
Reference in New Issue
Block a user