From 64d2ce8daf789e3e21edb518fba2a9b2ea2392ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=93=81?= Date: Thu, 28 Apr 2016 12:37:28 +0800 Subject: [PATCH] add testcase --- .../json/bvt/parser/array/BeanToArrayTest_date.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_date.java b/src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_date.java index 57641ad4c..fd0834a20 100644 --- a/src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_date.java +++ b/src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_date.java @@ -20,23 +20,27 @@ public class BeanToArrayTest_date extends TestCase { public void test_date() throws Exception { long time = System.currentTimeMillis(); - Model model = JSON.parseObject("[" + time + "]", Model.class, Feature.SupportArrayToBean); + Model model = JSON.parseObject("[" + time + "," + time + "]", Model.class, Feature.SupportArrayToBean); Assert.assertEquals(time, model.v1.getTime()); + Assert.assertEquals(time, model.v2.getTime()); } public void test_date_null() throws Exception { - Model model = JSON.parseObject("[null]", Model.class, Feature.SupportArrayToBean); + Model model = JSON.parseObject("[null,null]", Model.class, Feature.SupportArrayToBean); Assert.assertNull(model.v1); + Assert.assertNull(model.v2); } public void test_date2() throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale); dateFormat.setTimeZone(JSON.defaultTimeZone); - Model model = JSON.parseObject("[\"2016-01-01\"]", Model.class, Feature.SupportArrayToBean); + Model model = JSON.parseObject("[\"2016-01-01\",\"2016-01-02\"]", Model.class, Feature.SupportArrayToBean); Assert.assertEquals(dateFormat.parse("2016-01-01").getTime(), model.v1.getTime()); + Assert.assertEquals(dateFormat.parse("2016-01-02").getTime(), model.v2.getTime()); } public static class Model { public Date v1; + public Date v2; } }