forked from alibaba/fastjson
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add testcase for snake naming strategy
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/test/java/com/alibaba/json/bvt/parser/deser/SmartMatchTest_snake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.alibaba.json.bvt.parser.deser; | ||
|
||
import org.junit.Assert; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
|
||
import junit.framework.TestCase; | ||
|
||
|
||
public class SmartMatchTest_snake extends TestCase { | ||
|
||
public void test_0() throws Exception { | ||
String text = "{\"person_id\":1001}"; | ||
|
||
VO vo = JSON.parseObject(text, VO.class); | ||
Assert.assertEquals(1001, vo.personId); | ||
} | ||
|
||
public static class VO { | ||
public int personId; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/com/alibaba/json/bvt/parser/deser/SmartMatchTest_snake2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.alibaba.json.bvt.parser.deser; | ||
|
||
import org.junit.Assert; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
|
||
import junit.framework.TestCase; | ||
|
||
|
||
public class SmartMatchTest_snake2 extends TestCase { | ||
|
||
public void test_0() throws Exception { | ||
String text = "{\"_id\":1001}"; | ||
|
||
VO vo = JSON.parseObject(text, VO.class); | ||
Assert.assertEquals(1001, vo.id); | ||
} | ||
|
||
public static class VO { | ||
public int id; | ||
} | ||
} |