|
1 | 1 | package me.chanjar.weixin.open.api.impl;
|
2 | 2 |
|
| 3 | +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; |
| 4 | +import me.chanjar.weixin.common.error.WxErrorException; |
| 5 | +import org.testng.annotations.BeforeTest; |
3 | 6 | import org.testng.annotations.Test;
|
4 | 7 |
|
5 |
| -import static org.testng.Assert.*; |
6 |
| - |
7 | 8 | /**
|
8 | 9 | * 单元测试.
|
9 | 10 | *
|
10 | 11 | * @author <a href="https://github.com/binarywang">Binary Wang</a>
|
11 | 12 | * @date 2020-10-19
|
12 | 13 | */
|
13 | 14 | public class WxOpenOAuth2ServiceImplTest {
|
| 15 | + private final WxOpenOAuth2ServiceImpl service = new WxOpenOAuth2ServiceImpl("123", ""); |
| 16 | + |
| 17 | + @BeforeTest |
| 18 | + public void init() { |
| 19 | + this.service.setWxOpenConfigStorage(new WxOpenInMemoryConfigStorage()); |
| 20 | + } |
14 | 21 |
|
15 | 22 | @Test
|
16 | 23 | public void testBuildAuthorizationUrl() {
|
| 24 | + this.service.buildAuthorizationUrl("", "", ""); |
17 | 25 | }
|
18 | 26 |
|
19 | 27 | @Test
|
20 |
| - public void testGetAccessToken() { |
| 28 | + public void testGetAccessToken() throws WxErrorException { |
| 29 | + this.service.getAccessToken("a"); |
21 | 30 | }
|
22 | 31 |
|
23 | 32 | @Test
|
24 |
| - public void testTestGetAccessToken() { |
| 33 | + public void testTestGetAccessToken() throws WxErrorException { |
| 34 | + this.service.getAccessToken("", "", ""); |
25 | 35 | }
|
26 | 36 |
|
27 | 37 | @Test
|
28 |
| - public void testRefreshAccessToken() { |
| 38 | + public void testRefreshAccessToken() throws WxErrorException { |
| 39 | + this.service.refreshAccessToken(""); |
29 | 40 | }
|
30 | 41 |
|
31 | 42 | @Test
|
32 |
| - public void testGetUserInfo() { |
| 43 | + public void testGetUserInfo() throws WxErrorException { |
| 44 | + this.service.getUserInfo(new WxOAuth2AccessToken(), ""); |
33 | 45 | }
|
34 | 46 |
|
35 | 47 | @Test
|
36 | 48 | public void testValidateAccessToken() {
|
| 49 | + this.service.validateAccessToken(new WxOAuth2AccessToken()); |
37 | 50 | }
|
38 | 51 | }
|
0 commit comments