Package com.alibaba.json.bvt.parser.deser

Source Code of com.alibaba.json.bvt.parser.deser.BigIntegerDeserializerTest

package com.alibaba.json.bvt.parser.deser;

import java.math.BigInteger;

import junit.framework.Assert;
import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.DefaultExtJSONParser;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.BigIntegerDeserializer;

public class BigIntegerDeserializerTest extends TestCase {
    public void test_null() throws Exception {
        String input = "null";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        BigIntegerDeserializer deser = new BigIntegerDeserializer();

        Assert.assertNull(deser.deserialze(parser, null, null));
    }
   
    public void test_1() throws Exception {

        BigInteger value = JSON.parseObject("'123'", BigInteger.class);

        Assert.assertEquals(new BigInteger("123"), value);
    }
}
TOP

Related Classes of com.alibaba.json.bvt.parser.deser.BigIntegerDeserializerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.