重构WxError相关代码,自动根据代码补充错误中文说明

This commit is contained in:
Binary Wang
2018-05-14 23:42:28 +08:00
parent a9d552729c
commit ef97a308f3
173 changed files with 1240 additions and 361 deletions

View File

@@ -1,36 +0,0 @@
package me.chanjar.weixin.common.bean;
import me.chanjar.weixin.common.bean.result.WxError;
import org.testng.*;
import org.testng.annotations.*;
@Test
public class WxErrorTest {
public void testFromJson() {
String json = "{ \"errcode\": 40003, \"errmsg\": \"invalid openid\" }";
WxError wxError = WxError.fromJson(json);
Assert.assertTrue(wxError.getErrorCode() == 40003);
Assert.assertEquals(wxError.getErrorMsg(), "invalid openid");
}
public void testFromBadJson1() {
String json = "{ \"errcode\": 40003, \"errmsg\": \"invalid openid\", \"media_id\": \"12323423dsfafsf232f\" }";
WxError wxError = WxError.fromJson(json);
Assert.assertTrue(wxError.getErrorCode() == 40003);
Assert.assertEquals(wxError.getErrorMsg(), "invalid openid");
}
public void testFromBadJson2() {
String json = "{\"access_token\":\"ACCESS_TOKEN\",\"expires_in\":7200}";
WxError wxError = WxError.fromJson(json);
Assert.assertTrue(wxError.getErrorCode() == 0);
Assert.assertEquals(wxError.getErrorMsg(), null);
}
}