| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |
| 10 | 10 | ||
| 11 | 11 | import java.io.Serializable; | |
| 12 | + import java.util.List; | ||
| 12 | 13 | ||
| 13 | 14 | /** | |
| 14 | 15 | * @author borisbao | |
@@ -26,6 +27,18 @@ public class WxMaMediaAsyncCheckResult implements Serializable { | |||
| 26 | 27 | /** | |
| 27 | 28 | * 综合结果 | |
| 28 | 29 | */ | |
| 30 | + @SerializedName("result") | ||
| 31 | + private ResultBean result; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 详细检测结果列表 | ||
| 35 | + */ | ||
| 36 | + @SerializedName("detail") | ||
| 37 | + private List<DetailBean> detail; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 综合结果内部类定义 | ||
| 41 | + */ | ||
| 29 | 42 | @Data | |
| 30 | 43 | @Builder | |
| 31 | 44 | @XStreamAlias("result") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,52 @@ | |||
| 1 | + package cn.binarywang.wx.miniapp.bean; | ||
| 2 | + | ||
| 3 | + import org.testng.annotations.Test; | ||
| 4 | + | ||
| 5 | + import static org.testng.Assert.assertEquals; | ||
| 6 | + import static org.testng.Assert.assertNotNull; | ||
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * 测试多媒体内容安全异步检测结果解析 | ||
| 10 | + * | ||
| 11 | + * @author copilot | ||
| 12 | + */ | ||
| 13 | + @Test | ||
| 14 | + public class WxMaMediaAsyncCheckResultTest { | ||
| 15 | + | ||
| 16 | + public void testFromJsonWithResultAndDetail() { | ||
| 17 | + String json = "{\n" | ||
| 18 | + + " \"trace_id\": \"test_trace_id_001\",\n" | ||
| 19 | + + " \"result\": {\n" | ||
| 20 | + + " \"suggest\": \"risky\",\n" | ||
| 21 | + + " \"label\": 20001\n" | ||
| 22 | + + " },\n" | ||
| 23 | + + " \"detail\": [\n" | ||
| 24 | + + " {\n" | ||
| 25 | + + " \"strategy\": \"content_model\",\n" | ||
| 26 | + + " \"errcode\": 0,\n" | ||
| 27 | + + " \"suggest\": \"risky\",\n" | ||
| 28 | + + " \"label\": 20006,\n" | ||
| 29 | + + " \"prob\": 90\n" | ||
| 30 | + + " }\n" | ||
| 31 | + + " ]\n" | ||
| 32 | + + "}"; | ||
| 33 | + | ||
| 34 | + WxMaMediaAsyncCheckResult result = WxMaMediaAsyncCheckResult.fromJson(json); | ||
| 35 | + | ||
| 36 | + assertNotNull(result); | ||
| 37 | + assertEquals(result.getTraceId(), "test_trace_id_001"); | ||
| 38 | + | ||
| 39 | + assertNotNull(result.getResult()); | ||
| 40 | + assertEquals(result.getResult().getSuggest(), "risky"); | ||
| 41 | + assertEquals(result.getResult().getLabel(), "20001"); | ||
| 42 | + | ||
| 43 | + assertNotNull(result.getDetail()); | ||
| 44 | + assertEquals(result.getDetail().size(), 1); | ||
| 45 | + WxMaMediaAsyncCheckResult.DetailBean detail = result.getDetail().get(0); | ||
| 46 | + assertEquals(detail.getStrategy(), "content_model"); | ||
| 47 | + assertEquals(detail.getErrcode(), Integer.valueOf(0)); | ||
| 48 | + assertEquals(detail.getSuggest(), "risky"); | ||
| 49 | + assertEquals(detail.getLabel(), "20006"); | ||
| 50 | + assertEquals(detail.getProb(), Integer.valueOf(90)); | ||
| 51 | + } | ||
| 52 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments