1
0
mirror of synced 2026-10-16 20:36:15 +08:00
Files
WxJava/src/test/java/chanjarster/weixin/api/WxGroupAPITest.java
2014-08-26 16:16:14 +08:00

51 lines
1.2 KiB
Java

package chanjarster.weixin.api;
import java.util.List;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.WxGroup;
import chanjarster.weixin.exception.WxErrorException;
import com.google.inject.Inject;
/**
* 测试分组接口
*
* @author chanjarster
*/
@Test(groups = "groupAPI", dependsOnGroups = "baseAPI")
@Guice(modules = ApiTestModule.class)
public class WxGroupAPITest {
@Inject
protected WxServiceImpl wxService;
protected WxGroup group;
public void testGroupCreate() throws WxErrorException {
WxGroup res = wxService.groupCreate("测试分组1");
Assert.assertEquals(res.getName(), "测试分组1");
}
@Test(dependsOnMethods="testGroupCreate")
public void testGroupGet() throws WxErrorException {
List<WxGroup> groupList = wxService.groupGet();
Assert.assertNotNull(groupList);
Assert.assertTrue(groupList.size() > 0);
for (WxGroup g : groupList) {
group = g;
Assert.assertNotNull(g.getName());
}
}
@Test(dependsOnMethods={"testGroupGet", "testGroupCreate"})
public void getGroupUpdate() throws WxErrorException {
group.setName("分组改名");
wxService.groupUpdate(group);
}
}