### Question:
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException { File tmpFile = null; try { tmpFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType); return this.mediaUpload(mediaType, tmpFile); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build(), e); } finally { if (tmpFile != null) { tmpFile.delete(); } } } WxMpMaterialServiceImpl(WxMpService wxMpService); @Override WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream); @Override WxMediaUploadResult mediaUpload(String mediaType, File file); @Override File mediaDownload(String mediaId); @Override WxMediaImgUploadResult mediaImgUpload(File file); @Override WxMpMaterialUploadResult materialFileUpload(String mediaType, WxMpMaterial material); @Override WxMpMaterialUploadResult materialNewsUpload(WxMpMaterialNews news); @Override InputStream materialImageOrVoiceDownload(String mediaId); @Override WxMpMaterialVideoInfoResult materialVideoInfo(String mediaId); @Override WxMpMaterialNews materialNewsInfo(String mediaId); @Override boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate); @Override boolean materialDelete(String mediaId); @Override WxMpMaterialCountResult materialCount(); @Override WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count); @Override WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count);  }### Answer:
@Test(dataProvider = "mediaFiles") public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException { try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { WxMediaUploadResult res = this.wxService.getMaterialService().mediaUpload(mediaType, fileType, inputStream); assertNotNull(res.getType()); assertNotNull(res.getCreatedAt()); assertTrue(res.getMediaId() != null || res.getThumbMediaId() != null); if (res.getMediaId() != null && !mediaType.equals(WxConsts.MediaFileType.VIDEO)) { this.mediaIdsToDownload.add(res.getMediaId()); } if (res.getThumbMediaId() != null) { this.mediaIdsToDownload.add(res.getThumbMediaId()); } System.out.println(res); } }