From 5986698d4254c5e00631d4605c01ffbc8d938f40 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 15 Nov 2020 22:18:15 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/impl/WxOpenOAuth2ServiceImplTest.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) 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()); } }