Java 类com.alibaba.fastjson.serializer.FloatCodec 实例源码

项目:GitHub    文件:FloatDeserializerTest.java   
public void test_bigdecimal() throws Exception {
    Assert.assertEquals(0, JSON.parseObject("0", Float.class).intValue());
    Assert.assertEquals(0, JSON.parseObject("0.0", Float.class).intValue());
    Assert.assertEquals(0, JSON.parseObject("'0'", Float.class).intValue());

    Assert.assertEquals(null, JSON.parseObject("null", Float.class));

    DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
    Assert.assertEquals(null, FloatCodec.instance.deserialze(parser, null, null));
    Assert.assertEquals(JSONToken.LITERAL_INT, FloatCodec.instance.getFastMatchToken());
}