🎨 完善 NFC 小程序 scheme 接口测试代码
This commit is contained in:
@@ -24,7 +24,7 @@ public interface WxMaSchemeService {
|
||||
String generate(WxMaGenerateSchemeRequest request) throws WxErrorException;
|
||||
/**
|
||||
* 获取NFC 的小程序 scheme
|
||||
*文档地址:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/generateNFCScheme.html
|
||||
*文档地址:https://developers.weixin.qq.com/miniprogram/dev/server/API/qrcode-link/url-scheme/api_generatenfcscheme.html
|
||||
* @param request 请求参数
|
||||
* @throws WxErrorException 生成失败时抛出,具体错误码请看文档
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ public class WxMaSchemeServiceImpl implements WxMaSchemeService {
|
||||
|
||||
/**
|
||||
* 获取NFC 的小程序 scheme
|
||||
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/generateNFCScheme.html
|
||||
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/server/API/qrcode-link/url-scheme/api_generatenfcscheme.html
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @throws WxErrorException 生成失败时抛出,具体错误码请看文档
|
||||
|
||||
@@ -66,7 +66,7 @@ public class WxMaEmployeeRelationServiceImplTest {
|
||||
@Test
|
||||
public void testUnbinduserb2cauthinfo() throws WxErrorException {
|
||||
WxMaUnbindEmployeeRequest wxMaUnbindEmployeeRequest = new WxMaUnbindEmployeeRequest();
|
||||
wxMaUnbindEmployeeRequest.setOpenidList(List.of("o0uBr12b1zdgCk1qDoBivmSYb9GA"));
|
||||
wxMaUnbindEmployeeRequest.setOpenidList(Collections.singletonList("o0uBr12b1zdgCk1qDoBivmSYb9GA"));
|
||||
this.wxService.getEmployeeRelationService().unbindEmployee(wxMaUnbindEmployeeRequest);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.binarywang.wx.miniapp.bean.scheme;
|
||||
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class WxMaGenerateNfcSchemeRequestTest {
|
||||
@Test
|
||||
public void testToJson() {
|
||||
WxMaGenerateNfcSchemeRequest request = WxMaGenerateNfcSchemeRequest.newBuilder()
|
||||
.jumpWxa(WxMaGenerateNfcSchemeRequest.JumpWxa.newBuilder()
|
||||
.path("pages/index/index")
|
||||
.query("device=demo")
|
||||
.envVersion("trial")
|
||||
.build())
|
||||
.modelId("model-demo")
|
||||
.sn("sn-demo")
|
||||
.build();
|
||||
|
||||
String expectedJson = "{\n"
|
||||
+ " \"jump_wxa\": {\n"
|
||||
+ " \"path\": \"pages/index/index\",\n"
|
||||
+ " \"query\": \"device=demo\",\n"
|
||||
+ " \"env_version\": \"trial\"\n"
|
||||
+ " },\n"
|
||||
+ " \"model_id\": \"model-demo\",\n"
|
||||
+ " \"sn\": \"sn-demo\"\n"
|
||||
+ "}";
|
||||
|
||||
assertThat(request.toJson()).isEqualTo(GsonParser.parse(expectedJson).toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user