mirror of https://github.com/alibaba/fastjson2.git
add testcase
This commit is contained in:
parent
da3b4ac95d
commit
bc70e12e9a
|
|
@ -67,7 +67,21 @@ public class SmartMatchTest {
|
|||
assertEquals(123, bean.userId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test5() {
|
||||
String str = "[{\"user-id\":123,\"item\":{\"item_id\":201}}]";
|
||||
JSONArray array = JSON.parseArray(str);
|
||||
Bean bean = array.getObject(0, Bean.class);
|
||||
assertEquals(123, bean.userId);
|
||||
assertEquals(201, bean.item.itemId);
|
||||
}
|
||||
|
||||
public static class Bean {
|
||||
public int userId;
|
||||
public Item item;
|
||||
}
|
||||
|
||||
public static class Item {
|
||||
public int itemId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class Issue402 {
|
|||
@Test
|
||||
public void test1() {
|
||||
JSONArray jsonArray = JSON.parseArray(str);
|
||||
DeptTreeJson test = jsonArray.getObject(0, DeptTreeJson.class, JSONReader.Feature.SupportSmartMatch);
|
||||
DeptTreeJson test = jsonArray.getObject(0, DeptTreeJson.class);
|
||||
assertEquals("测试公司", test.getDeptName());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue