1+
12package me .chanjar .weixin .mp .api .impl ;
23
4+ import java .util .ArrayList ;
5+ import java .util .List ;
6+
37import org .testng .Assert ;
48import org .testng .annotations .Guice ;
59import org .testng .annotations .Test ;
913import me .chanjar .weixin .common .exception .WxErrorException ;
1014import me .chanjar .weixin .mp .api .ApiTestModule ;
1115import me .chanjar .weixin .mp .api .WxXmlMpInMemoryConfigStorage ;
16+ import me .chanjar .weixin .mp .bean .WxMpUserQuery ;
1217import me .chanjar .weixin .mp .bean .result .WxMpUser ;
1318import me .chanjar .weixin .mp .bean .result .WxMpUserList ;
1419
@@ -36,6 +41,24 @@ public void testUserInfo() throws WxErrorException {
3641 Assert .assertNotNull (user );
3742 System .out .println (user );
3843 }
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+ }
3962
4063 public void testUserList () throws WxErrorException {
4164 WxMpUserList wxMpUserList = this .wxService .getUserService ().userList (null );
@@ -45,5 +68,6 @@ public void testUserList() throws WxErrorException {
4568 Assert .assertFalse (wxMpUserList .getOpenIds ().size () == -1 );
4669 System .out .println (wxMpUserList );
4770 }
71+
4872
4973}
0 commit comments