mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 20:49:56 +08:00
fix(接口测试): 修复接口请求体会缩减数字精度的缺陷
--bug=1025842 --user=王孝刚 【接口测试】接口请求体会缩减数字精度 https://www.tapd.cn/55049933/s/1369188
This commit is contained in:
parent
1f09f13d00
commit
2626394659
@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -122,11 +123,11 @@ public class JSONSchemaParser {
|
|||||||
}
|
}
|
||||||
if (FormatterUtil.isMockValue(object)) {
|
if (FormatterUtil.isMockValue(object)) {
|
||||||
if (FormatterUtil.isNumber(FormatterUtil.getStrValue(object))) {
|
if (FormatterUtil.isNumber(FormatterUtil.getStrValue(object))) {
|
||||||
Number value = FormatterUtil.getElementValue(object).getAsNumber();
|
String value = FormatterUtil.getElementValue(object).getAsString();
|
||||||
if (value.toString().indexOf(".") == -1) {
|
if (value.indexOf(".") == -1) {
|
||||||
concept.put(propertyName, value.longValue());
|
concept.put(propertyName, Integer.valueOf(value));
|
||||||
} else {
|
} else {
|
||||||
concept.put(propertyName, value.floatValue());
|
concept.put(propertyName, new BigDecimal(value));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JSONSchemaBuilder.processValue(concept, processMap, propertyName, FormatterUtil.getStrValue(object));
|
JSONSchemaBuilder.processValue(concept, processMap, propertyName, FormatterUtil.getStrValue(object));
|
||||||
|
Loading…
Reference in New Issue
Block a user