1
+
1
2
package me .chanjar .weixin .mp .api .impl ;
2
3
4
+ import java .util .ArrayList ;
5
+ import java .util .List ;
6
+
3
7
import org .testng .Assert ;
4
8
import org .testng .annotations .Guice ;
5
9
import org .testng .annotations .Test ;
9
13
import me .chanjar .weixin .common .exception .WxErrorException ;
10
14
import me .chanjar .weixin .mp .api .ApiTestModule ;
11
15
import me .chanjar .weixin .mp .api .WxXmlMpInMemoryConfigStorage ;
16
+ import me .chanjar .weixin .mp .bean .WxMpUserQuery ;
12
17
import me .chanjar .weixin .mp .bean .result .WxMpUser ;
13
18
import me .chanjar .weixin .mp .bean .result .WxMpUserList ;
14
19
@@ -36,6 +41,24 @@ public void testUserInfo() throws WxErrorException {
36
41
Assert .assertNotNull (user );
37
42
System .out .println (user );
38
43
}
44
+
45
+ public void testUserInfoList () throws WxErrorException {
46
+ WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage ) this .wxService .getWxMpConfigStorage ();
47
+ List <String > openIdList = new ArrayList <>();
48
+ openIdList .add (configProvider .getOpenid ());
49
+ List <WxMpUser > userList = this .wxService .getUserService ().userInfoList (openIdList );
50
+ Assert .assertEquals (userList .size (), 1 );
51
+ System .out .println (userList );
52
+ }
53
+
54
+ public void testUserInfoListByWxMpUserQuery () throws WxErrorException {
55
+ WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage ) this .wxService .getWxMpConfigStorage ();
56
+ WxMpUserQuery query = new WxMpUserQuery ();
57
+ query .add (configProvider .getOpenid (), "zh_CN" );
58
+ List <WxMpUser > userList = this .wxService .getUserService ().userInfoList (query );
59
+ Assert .assertEquals (userList .size (), 1 );
60
+ System .out .println (userList );
61
+ }
39
62
40
63
public void testUserList () throws WxErrorException {
41
64
WxMpUserList wxMpUserList = this .wxService .getUserService ().userList (null );
@@ -45,5 +68,6 @@ public void testUserList() throws WxErrorException {
45
68
Assert .assertFalse (wxMpUserList .getOpenIds ().size () == -1 );
46
69
System .out .println (wxMpUserList );
47
70
}
71
+
48
72
49
73
}
0 commit comments