Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Add auto type support to remove dependency among tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rRajivramachandran committed Nov 13, 2023
1 parent c942c83 commit 25cfe10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/com/alibaba/fastjson/serializer/TestParse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.ParserConfig;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -28,9 +29,11 @@ public void prepareJsonString() {

@Test
public void testParse() {
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
logger.info("parsing json string:" + jsonString);
final ParserConfig parserConfig = new ParserConfig();
parserConfig.setAutoTypeSupport(true);
TestBean testBean = (TestBean) JSON.parse(jsonString, parserConfig);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
Expand Down

0 comments on commit 25cfe10

Please sign in to comment.