Skip to content

Commit 4929e4e

Browse files
committed
🎨 优化代码
1 parent 40ab5dd commit 4929e4e

File tree

4 files changed

+50
-42
lines changed

4 files changed

+50
-42
lines changed

weixin-java-pay/pom.xml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,11 @@
1212
<artifactId>weixin-java-pay</artifactId>
1313
<name>WxJava - PAY Java SDK</name>
1414
<description>微信支付 Java SDK</description>
15-
<build>
16-
<plugins>
17-
<plugin>
18-
<groupId>org.apache.maven.plugins</groupId>
19-
<artifactId>maven-compiler-plugin</artifactId>
20-
<configuration>
21-
<source>8</source>
22-
<target>8</target>
23-
</configuration>
24-
</plugin>
25-
</plugins>
26-
</build>
15+
16+
<properties>
17+
<maven.compiler.source>1.8</maven.compiler.source>
18+
<maven.compiler.target>1.8</maven.compiler.target>
19+
</properties>
2720

2821
<dependencies>
2922
<dependency>

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.github.binarywang.wxpay.bean.payscore;
22

33
import com.google.gson.annotations.SerializedName;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
46
import lombok.Data;
57
import lombok.NoArgsConstructor;
8+
import lombok.experimental.Accessors;
69

710
import java.io.Serializable;
811
import java.util.List;
@@ -11,8 +14,11 @@
1114
* @author doger.wang
1215
* @date 2020/5/12 16:36
1316
*/
14-
@NoArgsConstructor
1517
@Data
18+
@Builder
19+
@NoArgsConstructor
20+
@AllArgsConstructor
21+
@Accessors(chain = true)
1622
public class WxPayScoreRequest implements Serializable {
1723
private static final long serialVersionUID = 364764508076146082L;
1824

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ public String getV3(URI url) throws WxPayException {
144144
}
145145

146146
private CloseableHttpClient createApiV3HttpClient() throws WxPayException {
147-
CloseableHttpClient apiv3HttpClient = this.getConfig().getApiV3HttpClient();
148-
if (null == apiv3HttpClient) {
147+
CloseableHttpClient apiV3HttpClient = this.getConfig().getApiV3HttpClient();
148+
if (null == apiV3HttpClient) {
149149
return this.getConfig().initApiV3HttpClient();
150150
}
151-
return apiv3HttpClient;
151+
return apiV3HttpClient;
152152
}
153153

154154
private StringEntity createEntry(String requestStr) {
Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,55 @@
11
package com.github.binarywang.wxpay.service.impl;
22

3+
import com.github.binarywang.wxpay.bean.payscore.WxPayScoreRequest;
4+
import com.github.binarywang.wxpay.exception.WxPayException;
5+
import com.github.binarywang.wxpay.service.WxPayService;
6+
import com.github.binarywang.wxpay.testbase.ApiTestModule;
7+
import com.google.inject.Inject;
8+
import org.testng.annotations.Guice;
39
import org.testng.annotations.Test;
410

5-
import static org.testng.Assert.*;
6-
711
/**
812
* 测试代码,待补充完善.
913
*
1014
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1115
* @date 2020-05-19
1216
*/
17+
@Test
18+
@Guice(modules = ApiTestModule.class)
1319
public class PayScoreServiceImplTest {
20+
@Inject
21+
private WxPayService payService;
1422

15-
@Test
16-
public void testCreateServiceOrder() {
17-
}
23+
@Test
24+
public void testCreateServiceOrder() throws WxPayException {
25+
this.payService.getPayScoreService().createServiceOrder(WxPayScoreRequest.builder().build());
26+
}
1827

19-
@Test
20-
public void testQueryServiceOrder() {
21-
}
28+
@Test
29+
public void testQueryServiceOrder() {
30+
}
2231

23-
@Test
24-
public void testCancelServiceOrder() {
25-
}
32+
@Test
33+
public void testCancelServiceOrder() {
34+
}
2635

27-
@Test
28-
public void testModifyServiceOrder() {
29-
}
36+
@Test
37+
public void testModifyServiceOrder() {
38+
}
3039

31-
@Test
32-
public void testCompleteServiceOrder() {
33-
}
40+
@Test
41+
public void testCompleteServiceOrder() {
42+
}
3443

35-
@Test
36-
public void testPayServiceOrder() {
37-
}
44+
@Test
45+
public void testPayServiceOrder() {
46+
}
3847

39-
@Test
40-
public void testSyncServiceOrder() {
41-
}
48+
@Test
49+
public void testSyncServiceOrder() {
50+
}
4251

43-
@Test
44-
public void testDecryptNotifyData() {
45-
}
52+
@Test
53+
public void testDecryptNotifyData() {
54+
}
4655
}

0 commit comments

Comments
 (0)