Skip to content

Commit 1ceb4bf

Browse files
committed
尽量使用接口引用 use interface where possible
1 parent 639206c commit 1ceb4bf

19 files changed

+52
-49
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public void configure(Binder binder) {
1818
.getSystemResourceAsStream("test-config.xml")) {
1919
WxXmlMpInMemoryConfigStorage config = this
2020
.fromXml(WxXmlMpInMemoryConfigStorage.class, is1);
21-
WxMpServiceImpl wxService = new WxMpServiceImpl();
21+
WxMpService wxService = new WxMpServiceImpl();
2222
wxService.setWxMpConfigStorage(config);
2323

24-
binder.bind(WxMpServiceImpl.class).toInstance(wxService);
24+
binder.bind(WxMpService.class).toInstance(wxService);
2525
binder.bind(WxMpConfigStorage.class).toInstance(config);
2626
} catch (IOException e) {
2727
e.printStackTrace();

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

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

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5-
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
65
import org.apache.commons.lang3.StringUtils;
76
import org.testng.Assert;
87
import org.testng.annotations.Guice;
@@ -18,7 +17,7 @@
1817
public class WxMpBaseAPITest {
1918

2019
@Inject
21-
protected WxMpServiceImpl wxService;
20+
protected WxMpService wxService;
2221

2322
public void testRefreshAccessToken() throws WxErrorException {
2423
WxMpConfigStorage configStorage = this.wxService.getWxMpConfigStorage();

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
import me.chanjar.weixin.common.exception.WxErrorException;
1010
import me.chanjar.weixin.common.util.crypto.SHA1;
11-
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
1211

1312
/**
1413
* 测试jsapi ticket接口
15-
*
14+
*
1615
* @author chanjarster
1716
*/
1817
@Test(groups = "jsAPI", dependsOnGroups = "baseAPI")
1918
@Guice(modules = ApiTestModule.class)
2019
public class WxMpJsAPITest {
2120

2221
@Inject
23-
protected WxMpServiceImpl wxService;
22+
protected WxMpService wxService;
2423

2524

2625
public void testJsapiTicket() throws WxErrorException {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import me.chanjar.weixin.common.api.WxConsts;
1414
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
1515
import me.chanjar.weixin.common.exception.WxErrorException;
16-
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
1716
import me.chanjar.weixin.mp.bean.WxMpMassNews;
1817
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
1918
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
@@ -31,7 +30,7 @@
3130
public class WxMpMassMessageAPITest {
3231

3332
@Inject
34-
protected WxMpServiceImpl wxService;
33+
protected WxMpService wxService;
3534

3635
@Test
3736
public void testTextMassOpenIdsMessageSend() throws WxErrorException {

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

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

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5-
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
65
import org.testng.Assert;
76
import org.testng.annotations.Guice;
87
import org.testng.annotations.Test;
@@ -19,7 +18,7 @@
1918
public class WxMpMiscAPITest {
2019

2120
@Inject
22-
protected WxMpServiceImpl wxService;
21+
protected WxMpService wxService;
2322

2423
@Test
2524
public void testGetCallbackIP() throws WxErrorException {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.exception.WxErrorException;
5-
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
65
import org.testng.Assert;
76
import org.testng.annotations.Guice;
87
import org.testng.annotations.Test;
98

109
/**
1110
* 测试短连接
12-
*
11+
*
1312
* @author chanjarster
1413
*/
1514
@Test(groups = "shortURLAPI")
1615
@Guice(modules = ApiTestModule.class)
1716
public class WxMpShortUrlAPITest {
1817

1918
@Inject
20-
protected WxMpServiceImpl wxService;
19+
protected WxMpService wxService;
2120

2221
public void testShortUrl() throws WxErrorException {
2322
String shortUrl = this.wxService.shortUrl("www.baidu.com");

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.inject.Inject;
44
import me.chanjar.weixin.common.bean.WxCardApiSignature;
55
import me.chanjar.weixin.mp.api.ApiTestModule;
6+
import me.chanjar.weixin.mp.api.WxMpService;
67
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
78
import org.testng.annotations.Guice;
89
import org.testng.annotations.Test;
@@ -19,7 +20,7 @@
1920
public class WxMpCardServiceImplTest {
2021

2122
@Inject
22-
protected WxMpServiceImpl wxService;
23+
protected WxMpService wxService;
2324
private String cardId = "123";
2425
private String code = "good";
2526
private String openid = "abc";
@@ -90,4 +91,4 @@ public void testGetCardDetail() throws Exception {
9091
System.out.println(result);
9192
}
9293

93-
}
94+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.Date;
55
import java.util.List;
66

7+
import me.chanjar.weixin.mp.api.WxMpService;
78
import org.apache.commons.lang3.time.FastDateFormat;
89
import org.testng.Assert;
910
import org.testng.annotations.DataProvider;
@@ -32,7 +33,7 @@ public class WxMpDataCubeServiceImplTest {
3233
.getInstance("yyyy-MM-dd");
3334

3435
@Inject
35-
protected WxMpServiceImpl wxService;
36+
protected WxMpService wxService;
3637

3738
@DataProvider
3839
public Object[][] oneDay() throws ParseException {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import me.chanjar.weixin.common.api.WxConsts;
55
import me.chanjar.weixin.common.exception.WxErrorException;
66
import me.chanjar.weixin.mp.api.ApiTestModule;
7+
import me.chanjar.weixin.mp.api.WxMpService;
78
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
89
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
910
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
@@ -27,7 +28,7 @@
2728
public class WxMpKefuServiceImplTest {
2829

2930
@Inject
30-
protected WxMpServiceImpl wxService;
31+
protected WxMpService wxService;
3132

3233
public void testSendKefuMpNewsMessage() throws WxErrorException {
3334
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import me.chanjar.weixin.common.exception.WxErrorException;
77
import me.chanjar.weixin.common.util.fs.FileUtils;
88
import me.chanjar.weixin.mp.api.ApiTestModule;
9+
import me.chanjar.weixin.mp.api.WxMpService;
910
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
1011
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;
1112
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
@@ -32,7 +33,7 @@
3233
@Guice(modules = ApiTestModule.class)
3334
public class WxMpMaterialServiceImplTest {
3435
@Inject
35-
protected WxMpServiceImpl wxService;
36+
protected WxMpService wxService;
3637

3738
private Map<String, Map<String, Object>> mediaIds = new LinkedHashMap<>();
3839
// 缩略图的id,测试上传图文使用

0 commit comments

Comments
 (0)