add user black list api and impl

This commit is contained in:
miller
2016-09-20 14:39:39 +08:00
parent b17041ea96
commit b941a57ccd
8 changed files with 251 additions and 19 deletions

View File

@@ -0,0 +1,48 @@
package me.chanjar.weixin.mp.api.impl;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlackListGetResult;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
/**
* @author miller
*/
@Test(groups = "userAPI")
@Guice(modules = ApiTestModule.class)
public class WxMpUserBlackListServiceImplTest {
//此处openid只是开发的时候测试用 使用者测试的时候请替换自己公众号的openid
private final String TEST_OPENID = "o9VAswOI0KSXFUtFHgk9Kb9Rtkys";
@Inject
protected WxMpServiceImpl wxService;
@Test
public void testBlackList() throws Exception {
WxMpUserBlackListGetResult wxMpUserBlackListGetResult = this.wxService.getBlackListService().blackList(TEST_OPENID);
Assert.assertNotNull(wxMpUserBlackListGetResult);
Assert.assertFalse(wxMpUserBlackListGetResult.getCount() == -1);
Assert.assertFalse(wxMpUserBlackListGetResult.getTotal() == -1);
Assert.assertFalse(wxMpUserBlackListGetResult.getOpenIds().size() == -1);
System.out.println(wxMpUserBlackListGetResult);
}
@Test
public void testPushToBlackList() throws Exception {
List<String> openIdList = new ArrayList<>();
openIdList.add(TEST_OPENID);
this.wxService.getBlackListService().pushToBlackList(openIdList);
}
@Test
public void testPullFromBlackList() throws Exception {
List<String> openIdList = new ArrayList<>();
openIdList.add(TEST_OPENID);
this.wxService.getBlackListService().pullFromBlackList(openIdList);
}
}