Skip to content

Commit 2797bd6

Browse files
committed
🎨 重构部分单元测试代码
1 parent b5956fb commit 2797bd6

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpChatServiceImplTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ public void init() {
3838
}
3939

4040
@Test
41-
public void testChatCreate() throws Exception {
42-
final String result = cpService.getChatService().chatCreate("测试群聊", userId,
41+
public void testCreate() throws Exception {
42+
final String result = cpService.getChatService().create("测试群聊", userId,
4343
Arrays.asList(userId, userId), chatId);
4444
assertThat(result).isNotEmpty();
4545
assertThat(result).isEqualTo(chatId);
4646
}
4747

4848
@Test
49-
public void testChatGet() throws Exception {
50-
WxCpChat chat = this.cpService.getChatService().chatGet(chatId);
49+
public void testGet() throws Exception {
50+
WxCpChat chat = this.cpService.getChatService().get(chatId);
5151
System.out.println(chat);
5252
Assert.assertEquals(chat.getName(), "测试群聊");
5353
}
5454

5555
@Test
56-
public void testChatUpdate() throws Exception {
57-
this.cpService.getChatService().chatUpdate(chatId, "", "", Arrays.asList("ZhengWuYao"), null);
58-
WxCpChat chat = this.cpService.getChatService().chatGet(chatId);
56+
public void testUpdate() throws Exception {
57+
this.cpService.getChatService().update(chatId, "", "", Arrays.asList("ZhengWuYao"), null);
58+
WxCpChat chat = this.cpService.getChatService().get(chatId);
5959
System.out.println(chat);
6060
Assert.assertEquals(chat.getUsers().size(), 3);
6161
}

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpGroupRobotServiceTest.java renamed to weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpGroupRobotServiceImplTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
package me.chanjar.weixin.cp.api;
1+
package me.chanjar.weixin.cp.api.impl;
22

33
import com.google.inject.Inject;
44
import lombok.extern.slf4j.Slf4j;
55
import me.chanjar.weixin.common.error.WxErrorException;
66
import me.chanjar.weixin.common.util.fs.FileUtils;
7+
import me.chanjar.weixin.cp.api.ApiTestModule;
8+
import me.chanjar.weixin.cp.api.WxCpGroupRobotService;
9+
import me.chanjar.weixin.cp.api.WxCpService;
710
import me.chanjar.weixin.cp.bean.article.NewArticle;
811
import org.testng.annotations.BeforeTest;
912
import org.testng.annotations.Guice;
@@ -23,8 +26,7 @@
2326
*/
2427
@Slf4j
2528
@Guice(modules = ApiTestModule.class)
26-
public class WxCpGroupRobotServiceTest {
27-
29+
public class WxCpGroupRobotServiceImplTest {
2830
@Inject
2931
protected WxCpService wxService;
3032

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpTagServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class WxCpTagServiceImplTest {
4040

4141
@Test
4242
public void testCreate() throws Exception {
43-
this.tagId = this.wxService.getTagService().create("测试标签" + System.currentTimeMillis());
43+
this.tagId = this.wxService.getTagService().create("测试标签" + System.currentTimeMillis(), null);
4444
System.out.println(this.tagId);
4545
}
4646

weixin-java-cp/src/test/resources/testng.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
2-
3-
<suite name="Weixin-java-tool-suite" verbose="1">
2+
<!-- 不再维护 -->
3+
<suite name="WxJava-suite" verbose="1">
44
<test name="API_Test">
55
<classes>
66
<class name="me.chanjar.weixin.cp.api.WxCpBusyRetryTest"/>
77
<class name="me.chanjar.weixin.cp.api.WxCpBaseAPITest"/>
88
<class name="me.chanjar.weixin.cp.api.WxCpMessageAPITest"/>
99
<class name="me.chanjar.weixin.cp.api.WxCpMessageRouterTest"/>
10-
<class name="me.chanjar.weixin.cp.api.WxCpGroupRobotServiceTest"/>
1110
</classes>
1211
</test>
1312

0 commit comments

Comments
 (0)