fix (接口测试): 修复请求参数数字类型转换问题

--bug=1008475 --user=赵勇 【github#8035】当接口请求中存在一个数字超出integer范围时,会被转换为字符串的形式,不支持大数 https://www.tapd.cn/55049933/s/1079557
This commit is contained in:
fit2-zhao 2021-12-10 13:19:28 +08:00 committed by fit2-zhao
parent b8237b4cbd
commit 4e384680ff
2 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ public class JSONSchemaGenerator {
try {
Number value = object.get("mock").getAsJsonObject().get("mock").getAsNumber();
if (value.toString().indexOf(".") == -1) {
concept.put(propertyName, value.intValue());
concept.put(propertyName, value.longValue());
} else {
concept.put(propertyName, value.floatValue());
}

View File

@ -88,7 +88,7 @@ public class JSONSchemaRunTest {
if (object.has("mock") && object.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(object.get("mock").getAsJsonObject().get("mock").getAsString())) {
Number value = object.get("mock").getAsJsonObject().get("mock").getAsNumber();
if (value.toString().indexOf(".") == -1) {
concept.put(propertyName, value.intValue());
concept.put(propertyName, value.longValue());
} else {
concept.put(propertyName, value.floatValue());
}