🎨 重构优化小程序Link相关接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.shortlink.GenerateShortLinkRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
@@ -8,24 +9,29 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMaLinkServiceImplTest {
|
||||
|
||||
@Inject
|
||||
private WxMaService wxMaService;
|
||||
|
||||
@Test
|
||||
public void testGenerate() throws WxErrorException {
|
||||
|
||||
GenerateUrlLinkRequest request = GenerateUrlLinkRequest.builder()
|
||||
public void testGenerateUrlLink() throws WxErrorException {
|
||||
String url = this.wxMaService.getLinkService().generateUrlLink(GenerateUrlLinkRequest.builder()
|
||||
.path("pages/tabBar/home/home")
|
||||
.build();
|
||||
|
||||
String url = this.wxMaService.getLinkService().generate(request);
|
||||
.build());
|
||||
|
||||
System.out.println(url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateShortLink() throws WxErrorException {
|
||||
final String generate = this.wxMaService.getLinkService()
|
||||
.generateShortLink(GenerateShortLinkRequest.builder().
|
||||
pageUrl("pages/productView/editPhone/editPhone?id=31832")
|
||||
.pageTitle("productView")
|
||||
.isPermanent(false).build());
|
||||
System.out.println("generate:");
|
||||
System.out.println(generate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.shortlink.GenerateShortLinkRequest;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMaShortLinkServiceImplTest {
|
||||
@Inject
|
||||
private WxMaService wxService;
|
||||
|
||||
@Test
|
||||
public void testGenerate() throws WxErrorException {
|
||||
final String generate = this.wxService.getShortLinkService().generate(GenerateShortLinkRequest.builder().
|
||||
pageUrl("pages/productView/editPhone/editPhone?id=31832").pageTitle("productView").isPermanent(false).build());
|
||||
System.out.println("generate:");
|
||||
System.out.println(generate);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user