Skip to content

Commit

Permalink
fix testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed May 15, 2023
1 parent 64071b3 commit 1b81efd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.alibaba.fastjson;

import com.alibaba.fastjson.util.TypeUtils;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -10,6 +11,7 @@ public void test() {
Bean bean = new Bean();
bean.oAuth = "abc";

TypeUtils.compatibleWithFieldName = false;
assertEquals("{\"oAuth\":\"abc\"}", JSON.toJSONString(bean));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.alibaba.fastjson.issue_1400;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.util.TypeUtils;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -11,6 +12,7 @@ public void test_for_issue() throws Exception {
Model model = new Model();
model.md5 = "xxx";

TypeUtils.compatibleWithFieldName = false;
String json = JSON.toJSONString(model);
assertEquals("{\"mD5\":\"xxx\"}", json);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.alibaba.fastjson.v2issues;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.util.TypeUtils;
import org.junit.jupiter.api.Test;

Expand All @@ -18,6 +19,9 @@ public void test() {
assertEquals("{\"OrderActualAmount\":12.34}", JSON.toJSONString(bean));
} finally {
TypeUtils.compatibleWithFieldName = false;
SerializeConfig.DEFAULT_PROVIDER.setNamingStrategy(
com.alibaba.fastjson2.PropertyNamingStrategy.CamelCase1x
);
}
}

Expand Down

0 comments on commit 1b81efd

Please sign in to comment.