From 4929e4e03e1c339fab26946384e74414159b2378 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 19 May 2020 22:01:12 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weixin-java-pay/pom.xml | 17 ++---- .../bean/payscore/WxPayScoreRequest.java | 8 ++- .../impl/WxPayServiceApacheHttpImpl.java | 6 +- .../service/impl/PayScoreServiceImplTest.java | 61 +++++++++++-------- 4 files changed, 50 insertions(+), 42 deletions(-) diff --git a/weixin-java-pay/pom.xml b/weixin-java-pay/pom.xml index 6b89031f9..e9df87aa0 100644 --- a/weixin-java-pay/pom.xml +++ b/weixin-java-pay/pom.xml @@ -12,18 +12,11 @@ weixin-java-pay WxJava - PAY Java SDK 微信支付 Java SDK - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - + + + 1.8 + 1.8 + diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequest.java index 81fd04b8e..e76801b90 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequest.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequest.java @@ -1,8 +1,11 @@ package com.github.binarywang.wxpay.bean.payscore; import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import java.io.Serializable; import java.util.List; @@ -11,8 +14,11 @@ import java.util.List; * @author doger.wang * @date 2020/5/12 16:36 */ -@NoArgsConstructor @Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class WxPayScoreRequest implements Serializable { private static final long serialVersionUID = 364764508076146082L; diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java index 0e0d8e79d..1b2d08984 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java @@ -144,11 +144,11 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl { } private CloseableHttpClient createApiV3HttpClient() throws WxPayException { - CloseableHttpClient apiv3HttpClient = this.getConfig().getApiV3HttpClient(); - if (null == apiv3HttpClient) { + CloseableHttpClient apiV3HttpClient = this.getConfig().getApiV3HttpClient(); + if (null == apiV3HttpClient) { return this.getConfig().initApiV3HttpClient(); } - return apiv3HttpClient; + return apiV3HttpClient; } private StringEntity createEntry(String requestStr) { diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/PayScoreServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/PayScoreServiceImplTest.java index fa0c7b944..b10871b87 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/PayScoreServiceImplTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/PayScoreServiceImplTest.java @@ -1,46 +1,55 @@ package com.github.binarywang.wxpay.service.impl; +import com.github.binarywang.wxpay.bean.payscore.WxPayScoreRequest; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.testbase.ApiTestModule; +import com.google.inject.Inject; +import org.testng.annotations.Guice; import org.testng.annotations.Test; -import static org.testng.Assert.*; - /** * 测试代码,待补充完善. * * @author Binary Wang * @date 2020-05-19 */ +@Test +@Guice(modules = ApiTestModule.class) public class PayScoreServiceImplTest { + @Inject + private WxPayService payService; - @Test - public void testCreateServiceOrder() { - } + @Test + public void testCreateServiceOrder() throws WxPayException { + this.payService.getPayScoreService().createServiceOrder(WxPayScoreRequest.builder().build()); + } - @Test - public void testQueryServiceOrder() { - } + @Test + public void testQueryServiceOrder() { + } - @Test - public void testCancelServiceOrder() { - } + @Test + public void testCancelServiceOrder() { + } - @Test - public void testModifyServiceOrder() { - } + @Test + public void testModifyServiceOrder() { + } - @Test - public void testCompleteServiceOrder() { - } + @Test + public void testCompleteServiceOrder() { + } - @Test - public void testPayServiceOrder() { - } + @Test + public void testPayServiceOrder() { + } - @Test - public void testSyncServiceOrder() { - } + @Test + public void testSyncServiceOrder() { + } - @Test - public void testDecryptNotifyData() { - } + @Test + public void testDecryptNotifyData() { + } }