+1
-7
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>1.8.2</version>
|
||||
</parent>
|
||||
<artifactId>weixin4j-mp</artifactId>
|
||||
<name>weixin4j-mp</name>
|
||||
@@ -29,11 +29,5 @@
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>1.1.8</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -2,6 +2,7 @@ package com.foxinmy.weixin4j.mp.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -34,7 +35,7 @@ import com.foxinmy.weixin4j.type.MediaType;
|
||||
* @see
|
||||
*/
|
||||
public class MediaTest extends TokenTest {
|
||||
|
||||
|
||||
private MediaApi mediaApi;
|
||||
|
||||
@Before
|
||||
@@ -82,6 +83,18 @@ public class MediaTest extends TokenTest {
|
||||
System.err.println(mediaId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uploadVideo() throws WeixinException, FileNotFoundException {
|
||||
InputStream is = new FileInputStream("/Users/jy/Downloads/test.mp4");
|
||||
String fileName = "视频文件名";
|
||||
String title = "视频标题";
|
||||
String description = "视频描述";
|
||||
MpVideo mpVideo = mediaApi
|
||||
.uploadVideo(is, fileName, title, description);
|
||||
Assert.assertTrue(mpVideo.getMediaId() != null);
|
||||
System.err.println(mpVideo.getMediaId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uploadMaterialArticle() throws WeixinException {
|
||||
List<MpArticle> articles = new ArrayList<MpArticle>();
|
||||
@@ -94,7 +107,8 @@ public class MediaTest extends TokenTest {
|
||||
|
||||
@Test
|
||||
public void downloadArticle() throws WeixinException {
|
||||
List<MpArticle> articles = mediaApi.downloadArticle("DVWwU0u9ommOTPgyJszpK943IWCCVAcFGNmiIBObf5E");
|
||||
List<MpArticle> articles = mediaApi
|
||||
.downloadArticle("DVWwU0u9ommOTPgyJszpK943IWCCVAcFGNmiIBObf5E");
|
||||
Assert.assertTrue(articles != null && !articles.isEmpty());
|
||||
System.err.println(articles);
|
||||
}
|
||||
@@ -138,15 +152,4 @@ public class MediaTest extends TokenTest {
|
||||
.listAllMaterialMedia(MediaType.image);
|
||||
System.err.println(mediaList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uploadVideo() throws WeixinException {
|
||||
InputStream is = null;
|
||||
String fileName = "视频文件名";
|
||||
String title = "视频标题";
|
||||
String description = "视频描述";
|
||||
MpVideo mpVideo = mediaApi
|
||||
.uploadVideo(is, fileName, title, description);
|
||||
Assert.assertTrue(mpVideo.getMediaId() != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,12 @@ public class XmlstreamTest {
|
||||
sb.toString(),
|
||||
com.foxinmy.weixin4j.payment.mch.RefundRecord.class));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
XmlstreamTest.xml2order();
|
||||
XmlstreamTest.xml2refundRecordV2();
|
||||
XmlstreamTest.xml2refundRecordV3();
|
||||
XmlstreamTest.map2xml();
|
||||
XmlstreamTest.object2xmlWithRootElement();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user