Skip to content

Commit 123eb50

Browse files
committed
重构测试类的包结构
1 parent 5f3623a commit 123eb50

21 files changed

+62
-58
lines changed

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBaseAPITest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
56
import org.apache.commons.lang3.StringUtils;
67
import org.testng.Assert;
78
import org.testng.annotations.Guice;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpJsAPITest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.mp.api;
22

3+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
34
import org.testng.Assert;
45
import org.testng.annotations.Guice;
56
import org.testng.annotations.Test;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import me.chanjar.weixin.common.api.WxConsts;
55
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
66
import me.chanjar.weixin.common.exception.WxErrorException;
7+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
8+
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
79
import me.chanjar.weixin.mp.bean.WxMpMassNews;
810
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
911
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
@@ -33,7 +35,7 @@ public class WxMpMassMessageAPITest {
3335
@Test
3436
public void testTextMassOpenIdsMessageSend() throws WxErrorException {
3537
// 发送群发消息
36-
WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
38+
TestConfigStorage configProvider = (TestConfigStorage) this.wxService
3739
.getWxMpConfigStorage();
3840
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
3941
massMessage.setMsgType(WxConsts.MASS_MSG_TEXT);
@@ -47,10 +49,9 @@ public void testTextMassOpenIdsMessageSend() throws WxErrorException {
4749
}
4850

4951
@Test(dataProvider = "massMessages")
50-
public void testMediaMassOpenIdsMessageSend(String massMsgType,
51-
String mediaId) throws WxErrorException {
52+
public void testMediaMassOpenIdsMessageSend(String massMsgType, String mediaId) throws WxErrorException {
5253
// 发送群发消息
53-
WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
54+
TestConfigStorage configProvider = (TestConfigStorage) this.wxService
5455
.getWxMpConfigStorage();
5556
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
5657
massMessage.setMsgType(massMsgType);
@@ -83,8 +84,7 @@ public void testMediaMassGroupMessageSend(String massMsgType, String mediaId)
8384
WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
8485
massMessage.setMsgType(massMsgType);
8586
massMessage.setMediaId(mediaId);
86-
massMessage
87-
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
87+
massMessage.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
8888

8989
WxMpMassSendResult massResult = this.wxService
9090
.massGroupMessageSend(massMessage);
@@ -118,7 +118,7 @@ public Object[][] massMessages() throws WxErrorException, IOException {
118118
messages[0] = new Object[]{WxConsts.MASS_MSG_VIDEO, uploadResult.getMediaId()};
119119
}
120120

121-
/**
121+
/*
122122
* 图片素材
123123
*/
124124
try (InputStream inputStream = ClassLoader
@@ -130,7 +130,7 @@ public Object[][] massMessages() throws WxErrorException, IOException {
130130
messages[1] = new Object[]{WxConsts.MASS_MSG_IMAGE, uploadMediaRes.getMediaId()};
131131
}
132132

133-
/**
133+
/*
134134
* 语音素材
135135
*/
136136
try (InputStream inputStream = ClassLoader
@@ -142,7 +142,7 @@ public Object[][] massMessages() throws WxErrorException, IOException {
142142
messages[2] = new Object[]{WxConsts.MASS_MSG_VOICE, uploadMediaRes.getMediaId()};
143143
}
144144

145-
/**
145+
/*
146146
* 图文素材
147147
*/
148148
try (InputStream inputStream = ClassLoader

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
56
import org.testng.Assert;
67
import org.testng.annotations.Guice;
78
import org.testng.annotations.Test;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
56
import org.testng.Assert;
67
import org.testng.annotations.Guice;
78
import org.testng.annotations.Test;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpCardServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.bean.WxCardApiSignature;
5-
import me.chanjar.weixin.mp.api.ApiTestModule;
5+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
66
import me.chanjar.weixin.mp.api.WxMpService;
77
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
88
import org.testng.annotations.Guice;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDataCubeServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import com.google.inject.Inject;
1515

1616
import me.chanjar.weixin.common.exception.WxErrorException;
17-
import me.chanjar.weixin.mp.api.ApiTestModule;
17+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
1818
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult;
1919
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal;
2020
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeInterfaceResult;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDeviceServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import com.google.inject.Inject;
55
import me.chanjar.weixin.common.exception.WxErrorException;
6-
import me.chanjar.weixin.mp.api.ApiTestModule;
6+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
77
import me.chanjar.weixin.mp.api.WxMpService;
88
import me.chanjar.weixin.mp.bean.device.WxDeviceQrCodeResult;
99
import org.testng.annotations.DataProvider;

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.api.WxConsts;
55
import me.chanjar.weixin.common.exception.WxErrorException;
6-
import me.chanjar.weixin.mp.api.ApiTestModule;
6+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
77
import me.chanjar.weixin.mp.api.WxMpService;
8-
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
8+
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
99
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
1010
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
1111
import me.chanjar.weixin.mp.bean.kefu.result.*;
@@ -31,7 +31,7 @@ public class WxMpKefuServiceImplTest {
3131
protected WxMpService wxService;
3232

3333
public void testSendKefuMpNewsMessage() throws WxErrorException {
34-
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
34+
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
3535
.getWxMpConfigStorage();
3636
WxMpKefuMessage message = new WxMpKefuMessage();
3737
message.setMsgType(WxConsts.CUSTOM_MSG_MPNEWS);
@@ -42,7 +42,7 @@ public void testSendKefuMpNewsMessage() throws WxErrorException {
4242
}
4343

4444
public void testSendKefuMessage() throws WxErrorException {
45-
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
45+
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
4646
.getWxMpConfigStorage();
4747
WxMpKefuMessage message = new WxMpKefuMessage();
4848
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
@@ -54,7 +54,7 @@ public void testSendKefuMessage() throws WxErrorException {
5454
}
5555

5656
public void testSendKefuMessageWithKfAccount() throws WxErrorException {
57-
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
57+
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
5858
.getWxMpConfigStorage();
5959
WxMpKefuMessage message = new WxMpKefuMessage();
6060
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
@@ -85,7 +85,7 @@ public void testKfOnlineList() throws WxErrorException {
8585

8686
@DataProvider
8787
public Object[][] getKfAccount() {
88-
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
88+
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
8989
.getWxMpConfigStorage();
9090
return new Object[][] { { configStorage.getKfAccount() } };
9191
}
@@ -131,7 +131,7 @@ public void testKfAccountDel(String kfAccount) throws WxErrorException {
131131

132132
@DataProvider
133133
public Object[][] getKfAccountAndOpenid() {
134-
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
134+
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
135135
.getWxMpConfigStorage();
136136
return new Object[][] {
137137
{ configStorage.getKfAccount(), configStorage.getOpenid() } };

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
66
import me.chanjar.weixin.common.exception.WxErrorException;
77
import me.chanjar.weixin.common.util.fs.FileUtils;
8-
import me.chanjar.weixin.mp.api.ApiTestModule;
8+
import me.chanjar.weixin.mp.api.test.ApiTestModule;
99
import me.chanjar.weixin.mp.api.WxMpService;
1010
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
1111
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;

0 commit comments

Comments
 (0)