@@ -36,7 +36,8 @@ public class WxCpMediaServiceImplTest {
36
36
public Object [][] mediaData () {
37
37
return new Object [][]{
38
38
new Object []{WxConsts .MediaFileType .IMAGE , TestConstants .FILE_JPG , "mm.jpeg" },
39
- new Object []{WxConsts .MediaFileType .VOICE , TestConstants .FILE_MP3 , "mm.mp3" },//{"errcode":301017,"errmsg":"voice file only support amr like myvoice.amr"}
39
+ //new Object[]{WxConsts.MediaFileType.VOICE, TestConstants.FILE_MP3, "mm.mp3"},
40
+ // {"errcode":301017,"errmsg":"voice file only support amr like myvoice.amr"}
40
41
new Object []{WxConsts .MediaFileType .VOICE , TestConstants .FILE_AMR , "mm.amr" },
41
42
new Object []{WxConsts .MediaFileType .VIDEO , TestConstants .FILE_MP4 , "mm.mp4" },
42
43
new Object []{WxConsts .MediaFileType .FILE , TestConstants .FILE_JPG , "mm.jpeg" }
@@ -47,8 +48,9 @@ public Object[][] mediaData() {
47
48
public void testUploadMedia (String mediaType , String fileType , String fileName ) throws WxErrorException , IOException {
48
49
try (InputStream inputStream = ClassLoader .getSystemResourceAsStream (fileName )) {
49
50
WxMediaUploadResult res = this .wxService .getMediaService ().upload (mediaType , fileType , inputStream );
50
- assertNotNull (res .getType ());
51
- assertNotNull (res .getCreatedAt ());
51
+ assertThat (res ).isNotNull ();
52
+ assertThat (res .getType ()).isNotEmpty ();
53
+ assertThat (res .getCreatedAt ()).isGreaterThan (0 );
52
54
assertTrue (res .getMediaId () != null || res .getThumbMediaId () != null );
53
55
54
56
if (res .getMediaId () != null ) {
@@ -70,9 +72,9 @@ public Object[][] downloadMedia() {
70
72
}
71
73
72
74
@ Test (dependsOnMethods = {"testUploadMedia" }, dataProvider = "downloadMedia" )
73
- public void testDownloadMedia (String media_id ) throws WxErrorException {
74
- File file = this .wxService .getMediaService ().download (media_id );
75
- assertNotNull (file );
75
+ public void testDownload (String mediaId ) throws WxErrorException {
76
+ File file = this .wxService .getMediaService ().download (mediaId );
77
+ assertThat (file ). isNotNull ( );
76
78
System .out .println (file );
77
79
}
78
80
@@ -82,4 +84,11 @@ public void testUploadImg() throws WxErrorException {
82
84
String res = this .wxService .getMediaService ().uploadImg (new File (url .getFile ()));
83
85
assertThat (res ).isNotEmpty ();
84
86
}
87
+
88
+ @ Test
89
+ public void testGetJssdkFile () throws WxErrorException {
90
+ File file = this .wxService .getMediaService ().getJssdkFile ("...." );
91
+ assertThat (file ).isNotNull ();
92
+ System .out .println (file );
93
+ }
85
94
}
0 commit comments