-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61f1179
commit bbb5269
Showing
3 changed files
with
178 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 79 additions & 12 deletions
91
...iapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeSubmitAuditRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,97 @@ | ||
package cn.binarywang.wx.miniapp.bean.code; | ||
|
||
import me.chanjar.weixin.common.util.json.GsonParser; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author <a href="https://github.com/charmingoh">Charming</a> | ||
* @since 2018-04-26 19:55 | ||
*/ | ||
public class WxMaCodeSubmitAuditRequestTest { | ||
@Test | ||
public void testToJson() { | ||
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest | ||
.builder() | ||
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest.builder() | ||
.itemList(Arrays.asList( | ||
WxMaCategory | ||
.builder() | ||
.address("pages/logs/logs") | ||
.tag("工具 效率") | ||
.firstClass("工具") | ||
.firstId(287L) | ||
.secondClass("效率") | ||
.secondId(616L) | ||
WxMaCategory.builder() | ||
.address("index") | ||
.tag("学习 生活") | ||
.firstClass("文娱") | ||
.firstId(1L) | ||
.secondClass("资讯") | ||
.secondId(2L) | ||
.title("首页") | ||
.build(), | ||
WxMaCategory.builder() | ||
.address("page/logs/logs") | ||
.tag("学习 工作") | ||
.firstClass("教育") | ||
.firstId(3L) | ||
.secondClass("学历教育") | ||
.secondId(4L) | ||
.thirdClass("高等") | ||
.thirdId(5L) | ||
.title("日志") | ||
.build() | ||
)).build(); | ||
System.out.println(request.toJson()); | ||
)) | ||
.feedbackInfo("blablabla") | ||
.feedbackStuff("xx|yy|zz") | ||
.previewInfo(new WxMaCodeSubmitAuditRequest.PreviewInfo().setVideoIdList(Arrays.asList("xxxx")) | ||
.setPicIdList(Arrays.asList("xxxx", "yyyy", "zzzz"))) | ||
.versionDesc("blablabla") | ||
.ugcDeclare(new WxMaCodeSubmitAuditRequest.UgcDeclare() | ||
.setAuditDesc("blablabla") | ||
.setHasAuditTeam(1) | ||
.setMethod(new Integer[]{1}) | ||
.setScene(new Integer[]{1, 2}) | ||
).build(); | ||
|
||
String expectedJson = "{\n" + | ||
"\t\"item_list\": [\n" + | ||
"\t{\n" + | ||
"\t\t\"address\":\"index\",\n" + | ||
"\t\t\"tag\":\"学习 生活\",\n" + | ||
"\t\t\"first_class\": \"文娱\",\n" + | ||
"\t\t\"second_class\": \"资讯\",\n" + | ||
"\t\t\"first_id\":1,\n" + | ||
"\t\t\"second_id\":2,\n" + | ||
"\t\t\"title\": \"首页\"\n" + | ||
"\t},\n" + | ||
"\t{\n" + | ||
"\t\t\"address\":\"page/logs/logs\",\n" + | ||
"\t\t\"tag\":\"学习 工作\",\n" + | ||
"\t\t\"first_class\": \"教育\",\n" + | ||
"\t\t\"second_class\": \"学历教育\",\n" + | ||
"\t\t\"third_class\": \"高等\",\n" + | ||
"\t\t\"first_id\":3,\n" + | ||
"\t\t\"second_id\":4,\n" + | ||
"\t\t\"third_id\":5,\n" + | ||
"\t\t\"title\": \"日志\"\n" + | ||
"\t}\n" + | ||
"\t],\n" + | ||
"\t\"feedback_info\": \"blablabla\",\n" + | ||
" \"feedback_stuff\": \"xx|yy|zz\",\n" + | ||
" \"preview_info\" : {\n" + | ||
" \"video_id_list\": [\"xxxx\"],\n" + | ||
" \"pic_id_list\": [\"xxxx\", \"yyyy\", \"zzzz\" ]\n" + | ||
" },\n" + | ||
" \"version_desc\":\"blablabla\",\n" + | ||
" \"ugc_declare\": {\n" + | ||
" \"scene\": [\n" + | ||
" 1,\n" + | ||
" 2\n" + | ||
" ],\n" + | ||
" \"method\": [\n" + | ||
" 1\n" + | ||
" ],\n" + | ||
" \"has_audit_team\": 1,\n" + | ||
" \"audit_desc\": \"blablabla\"\n" + | ||
" }\n" + | ||
"}\n" + | ||
""; | ||
assertThat(request.toJson().replace("\n", "")).isEqualTo(GsonParser.parse(expectedJson).toString()); | ||
} | ||
} |