fix(接口测试): 修复jsonpath断言判断null值失败的缺陷
--bug=1019569 --user=王孝刚 [接口测试]github#19637jsonpath断言,响应体中字段为null的值识别不到,导致断言失败 https://www.tapd.cn/55049933/s/1317177
This commit is contained in:
parent
9965baba5f
commit
c85972a808
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import io.metersphere.vo.Condition;
|
||||
import io.metersphere.vo.ElementCondition;
|
||||
import net.minidev.json.JSONArray;
|
||||
|
@ -106,7 +106,7 @@ public class DocumentUtils {
|
|||
if (subj == null) {
|
||||
str = "null";
|
||||
} else if (subj instanceof Map) {
|
||||
str = new Gson().toJson(subj);
|
||||
str = new GsonBuilder().serializeNulls().create().toJson(subj);
|
||||
} else if (!(subj instanceof Double) && !(subj instanceof Float)) {
|
||||
str = subj.toString();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue