diff --git a/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java b/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java index 17387fcc1..c32eb1fcf 100644 --- a/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java +++ b/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java @@ -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()); } }