Skip to content

Commit 867293e

Browse files
Copilotbinarywang
andcommitted
修改作者标签为copilot并添加InputStream测试用例
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
1 parent 0e23226 commit 867293e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/media/VideoUploadResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* 视频文件上传返回结果对象
1010
*
11-
* @author Binary Wang
11+
* @author copilot
1212
*/
1313
@NoArgsConstructor
1414
@Data

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MerchantMediaServiceImplTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,23 @@ public void testVideoUploadV3() throws WxPayException, IOException {
7474
log.info("视频上传成功2,mediaId2:[{}]", mediaId2);
7575

7676
}
77+
78+
@Test
79+
public void testVideoUploadV3WithInputStream() throws WxPayException, IOException {
80+
81+
MerchantMediaService merchantMediaService = new MerchantMediaServiceImpl(wxPayService);
82+
83+
String filePath = "你的视频文件的路径地址";
84+
// String filePath = "WxJava/test-video.mp4";
85+
86+
File file = new File(filePath);
87+
88+
try (java.io.FileInputStream inputStream = new java.io.FileInputStream(file)) {
89+
VideoUploadResult videoUploadResult = merchantMediaService.videoUploadV3(inputStream, file.getName());
90+
String mediaId = videoUploadResult.getMediaId();
91+
92+
log.info("通过InputStream上传视频成功,mediaId:[{}]", mediaId);
93+
}
94+
95+
}
7796
}

0 commit comments

Comments
 (0)