Materials { public MaterialPagination list(MediaType mediaType, int offset, int count) { if (mediaType != MediaType.news && mediaType != MediaType.mpnews) { String url = WxEndpoint.get("url.material.list"); String body = "{\"type\":\"%s\",\"offset\":%s,\"count\":%s}"; String response = wxClient.post(url, String.format(body, mediaType.name(), offset, count)); logger.debug("list materials: {}", response); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, MpMaterialSearchResult.class)); } else { throw new WxRuntimeException(999, "cannot support mpnews list."); } }  static Materials defaultMaterials(); static Materials with(AppSetting appSetting); void setWxClient(WxClient wxClient); String addMpNewsImage(InputStream inputStream, String fileName); String addMpNews(MpNews mpNews); MpNews getMpNews(String mediaId); void updateMpNews(String mediaId, int index, MpArticle article); Material addVoice(InputStream inputStream, String fileName); InputStream getVoice(String mediaId); Material addImage(InputStream inputStream, String fileName); InputStream getImage(String mediaId); Material addThumb(InputStream inputStream, String fileName); InputStream getThumb(String mediaId); Material addVideo(InputStream inputStream, String fileName, String title, String description); Video getVideo(String mediaId); Counts count(); MaterialPagination list(MediaType mediaType, int offset, int count); MpNewsPagination listMpNews(int offset, int count); void delete(String mediaId);  }
@Test public void testList() { MaterialPagination materialPagination = Materials.defaultMaterials().list(MediaType.image, 0, 10); Assert.assertNotNull(materialPagination); MpNewsPagination mpNewsPagination = Materials.defaultMaterials().listMpNews(0, 10); Assert.assertNotNull(mpNewsPagination); }