@@ -36,7 +36,8 @@ public class WxCpMediaServiceImplTest {
3636 public Object [][] mediaData () {
3737 return new Object [][]{
3838 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"}
4041 new Object []{WxConsts .MediaFileType .VOICE , TestConstants .FILE_AMR , "mm.amr" },
4142 new Object []{WxConsts .MediaFileType .VIDEO , TestConstants .FILE_MP4 , "mm.mp4" },
4243 new Object []{WxConsts .MediaFileType .FILE , TestConstants .FILE_JPG , "mm.jpeg" }
@@ -47,8 +48,9 @@ public Object[][] mediaData() {
4748 public void testUploadMedia (String mediaType , String fileType , String fileName ) throws WxErrorException , IOException {
4849 try (InputStream inputStream = ClassLoader .getSystemResourceAsStream (fileName )) {
4950 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 );
5254 assertTrue (res .getMediaId () != null || res .getThumbMediaId () != null );
5355
5456 if (res .getMediaId () != null ) {
@@ -70,9 +72,9 @@ public Object[][] downloadMedia() {
7072 }
7173
7274 @ 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 ( );
7678 System .out .println (file );
7779 }
7880
@@ -82,4 +84,11 @@ public void testUploadImg() throws WxErrorException {
8284 String res = this .wxService .getMediaService ().uploadImg (new File (url .getFile ()));
8385 assertThat (res ).isNotEmpty ();
8486 }
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+ }
8594}
0 commit comments