| @@ -3,7 +3,7 @@ package me.chanjar.weixin.enterprise.bean; | |||||
| import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder; | import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder; | ||||
| /** | /** | ||||
| * 微信用户分组 | |||||
| * 微信部门 | |||||
| * @author Daniel Qian | * @author Daniel Qian | ||||
| * | * | ||||
| */ | */ | ||||
| @@ -11,7 +11,9 @@ public class WxCpDepart { | |||||
| private long id = -1; | private long id = -1; | ||||
| private String name; | private String name; | ||||
| private long count; | |||||
| private long parentId; | |||||
| private long order; | |||||
| public long getId() { | public long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -24,13 +26,7 @@ public class WxCpDepart { | |||||
| public void setName(String name) { | public void setName(String name) { | ||||
| this.name = name; | this.name = name; | ||||
| } | } | ||||
| public long getCount() { | |||||
| return count; | |||||
| } | |||||
| public void setCount(long count) { | |||||
| this.count = count; | |||||
| } | |||||
| public static WxCpDepart fromJson(String json) { | public static WxCpDepart fromJson(String json) { | ||||
| return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class); | return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class); | ||||
| } | } | ||||
| @@ -38,9 +34,14 @@ public class WxCpDepart { | |||||
| public String toJson() { | public String toJson() { | ||||
| return WxCpGsonBuilder.create().toJson(this); | return WxCpGsonBuilder.create().toJson(this); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return "WxGroup [id=" + id + ", name=" + name + ", count=" + count + "]"; | |||||
| return "WxCpDepart{" + | |||||
| "id=" + id + | |||||
| ", name='" + name + '\'' + | |||||
| ", parentId=" + parentId + | |||||
| ", order=" + order + | |||||
| '}'; | |||||
| } | } | ||||
| } | } | ||||
| @@ -18,12 +18,12 @@ import com.google.inject.Inject; | |||||
| */ | */ | ||||
| @Test(groups = "groupAPI", dependsOnGroups = "baseAPI") | @Test(groups = "groupAPI", dependsOnGroups = "baseAPI") | ||||
| @Guice(modules = ApiTestModule.class) | @Guice(modules = ApiTestModule.class) | ||||
| public class WxGroupAPITest { | |||||
| public class WxCpDepartAPITest { | |||||
| @Inject | @Inject | ||||
| protected WxCpServiceImpl wxService; | protected WxCpServiceImpl wxService; | ||||
| protected WxCpDepart group; | |||||
| protected WxCpDepart depart; | |||||
| public void testGroupCreate() throws WxErrorException { | public void testGroupCreate() throws WxErrorException { | ||||
| WxCpDepart res = wxService.departmentCreate("测试分组1"); | WxCpDepart res = wxService.departmentCreate("测试分组1"); | ||||
| @@ -36,15 +36,15 @@ public class WxGroupAPITest { | |||||
| Assert.assertNotNull(groupList); | Assert.assertNotNull(groupList); | ||||
| Assert.assertTrue(groupList.size() > 0); | Assert.assertTrue(groupList.size() > 0); | ||||
| for (WxCpDepart g : groupList) { | for (WxCpDepart g : groupList) { | ||||
| group = g; | |||||
| depart = g; | |||||
| Assert.assertNotNull(g.getName()); | Assert.assertNotNull(g.getName()); | ||||
| } | } | ||||
| } | } | ||||
| @Test(dependsOnMethods={"testGroupGet", "testGroupCreate"}) | @Test(dependsOnMethods={"testGroupGet", "testGroupCreate"}) | ||||
| public void getGroupUpdate() throws WxErrorException { | public void getGroupUpdate() throws WxErrorException { | ||||
| group.setName("分组改名"); | |||||
| wxService.departmentUpdate(group); | |||||
| depart.setName("分组改名"); | |||||
| wxService.departmentUpdate(depart); | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,7 +6,7 @@ | |||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpBaseAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpBaseAPITest" /> | ||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" /> | ||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" /> | ||||
| <class name="me.chanjar.weixin.enterprise.api.WxGroupAPITest" /> | |||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpDepartAPITest" /> | |||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpMediaAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMediaAPITest" /> | ||||
| <class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" /> | ||||
| </classes> | </classes> | ||||