mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 增加点单元测试示例代码
This commit is contained in:
parent
6d556f8b1d
commit
5986698d42
@ -1,9 +1,10 @@
|
||||
package me.chanjar.weixin.open.api.impl;
|
||||
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* 单元测试.
|
||||
*
|
||||
@ -11,28 +12,40 @@ import static org.testng.Assert.*;
|
||||
* @date 2020-10-19
|
||||
*/
|
||||
public class WxOpenOAuth2ServiceImplTest {
|
||||
private final WxOpenOAuth2ServiceImpl service = new WxOpenOAuth2ServiceImpl("123", "");
|
||||
|
||||
@BeforeTest
|
||||
public void init() {
|
||||
this.service.setWxOpenConfigStorage(new WxOpenInMemoryConfigStorage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildAuthorizationUrl() {
|
||||
this.service.buildAuthorizationUrl("", "", "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAccessToken() {
|
||||
public void testGetAccessToken() throws WxErrorException {
|
||||
this.service.getAccessToken("a");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTestGetAccessToken() {
|
||||
public void testTestGetAccessToken() throws WxErrorException {
|
||||
this.service.getAccessToken("", "", "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRefreshAccessToken() {
|
||||
public void testRefreshAccessToken() throws WxErrorException {
|
||||
this.service.refreshAccessToken("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserInfo() {
|
||||
public void testGetUserInfo() throws WxErrorException {
|
||||
this.service.getUserInfo(new WxOAuth2AccessToken(), "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateAccessToken() {
|
||||
this.service.validateAccessToken(new WxOAuth2AccessToken());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user