public void test_bigdecimal() throws Exception { Assert.assertEquals(1309861159710L, JSON.parseObject("1309861159710", java.sql.Date.class).getTime()); Assert.assertEquals(1309861159710L, JSON.parseObject("1309861159710.0", java.sql.Date.class).getTime()); Assert.assertEquals(1309861159710L, JSON.parseObject("'1309861159710'", java.sql.Date.class).getTime()); Assert.assertEquals(null, JSON.parseObject("null", Integer.class)); DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE); Assert.assertEquals(null, SqlDateDeserializer.instance.deserialze(parser, null, null)); Assert.assertEquals(JSONToken.LITERAL_INT, SqlDateDeserializer.instance.getFastMatchToken()); }
public void test_match() throws Exception { Assert.assertEquals(JSONToken.LBRACKET, AtomicCodec.instance.getFastMatchToken()); Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken()); Assert.assertEquals(JSONToken.LITERAL_INT, NumberDeserializer.instance.getFastMatchToken()); Assert.assertEquals(JSONToken.LITERAL_INT, SqlDateDeserializer.instance.getFastMatchToken()); Assert.assertEquals(JSONToken.LBRACKET, ObjectArrayCodec.instance.getFastMatchToken()); Assert.assertEquals(JSONToken.LITERAL_STRING, CharacterCodec.instance.getFastMatchToken()); }